public string ProcessArticle(IAutoWikiBrowser sender, IProcessArticleEventArgs eventargs)
{
//If menu item is not checked, then return
if (!PluginEnabled || Settings.Images.Count == 0)
{
eventargs.Skip = false;
return eventargs.ArticleText;
}
string text = eventargs.ArticleText;
string removed = "", replaced = "";
foreach (KeyValuePair<string, string> p in Settings.Images)
{
bool noChange;
if (p.Value.Length == 0)
{
text = Parsers.RemoveImage(p.Key, text, Settings.Comment, "", out noChange);
if (!noChange)
{
if (!string.IsNullOrEmpty(removed))
{
removed += ", ";
}
removed += Variables.Namespaces[Namespace.File] + p.Key;
}
}
else
{
text = Parsers.ReplaceImage(p.Key, p.Value, text, out noChange);
if (!noChange)
{
if (!string.IsNullOrEmpty(replaced))
{
replaced += ", ";
}
replaced += Variables.Namespaces[Namespace.File]
+ p.Key + FindandReplace.Arrow + Variables.Namespaces[Namespace.File] + p.Value;
}
}
if (!noChange)
{
text = Regex.Replace(text, "<includeonly>[\\s\\r\\n]*\\</includeonly>", "");
}
}
string editSummary = "";
if (Settings.AppendToEditSummary)
{
if (!string.IsNullOrEmpty(replaced))
editSummary = "replaced: " + replaced.Trim();
if (!string.IsNullOrEmpty(removed))
{
if (!string.IsNullOrEmpty(editSummary))
editSummary += ", ";
editSummary += "removed: " + removed.Trim();
}
}
eventargs.EditSummary = editSummary;
eventargs.Skip = (text == eventargs.ArticleText) && Settings.Skip;
return text;
}