private static string FinaliseArticleProcessing(Article theArticle, ref bool skip, ref string summary,
string articleText, bool reqPhoto)
{
SkipReason skipReason = SkipReason.Other;
if (theArticle.PluginManagerGetSkipResults == SkipResults.NotSet)
{
_pluginSettings.PluginStats.Tagged += 1;
}
else
{
switch (theArticle.PluginManagerGetSkipResults)
{
case SkipResults.SkipBadTag:
// always skip
if (_pluginSettings.SkipBadTags)
{
_pluginSettings.PluginStats.SkippedBadTagIncrement();
if (_pluginSettings.OpenBadInBrowser)
{
theArticle.EditInBrowser();
}
skip = true;
// always skip
skipReason = SkipReason.BadTag;
}
else
{
// the plugin manager stops processing when it gets a bad tag. We know however
// that one plugin found a bad template and possibly replaced it with
// conTemplatePlaceholder. We're also not skipping, so we need to remove the placeholder
theArticle.AlteredArticleText =
theArticle.AlteredArticleText.Replace(Constants.TemplaterPlaceholder, "");
MessageBox.Show("Bad tag. Please fix it manually or click ignore.", "Bad tag",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
_pluginSettings.PluginStats.Tagged += 1;
}
break;
case SkipResults.SkipRegex:
case SkipResults.SkipNoChange:
if (theArticle.ProcessIt)
{
_pluginSettings.PluginStats.Tagged += 1;
}
else
{
if (theArticle.PluginManagerGetSkipResults == SkipResults.SkipRegex)
{
_pluginSettings.PluginStats.SkippedMiscellaneousIncrement();
skip = true;
skipReason = SkipReason.Regex;
// No change:
}
else
{
if (_pluginSettings.SkipWhenNoChange)
{
_pluginSettings.PluginStats.SkippedNoChangeIncrement();
skipReason = SkipReason.NoChange;
skip = true;
}
else
{
_pluginSettings.PluginStats.Tagged += 1;
skip = false;
}
}
}
break;
}
}
if (skip)
{
return(Skipping(ref summary, theArticle.EditSummary, skipReason, articleText, ref skip));
}
if (reqPhoto)
{
theArticle.AlteredArticleText = ReqPhotoNoParamsRegex.Replace(theArticle.AlteredArticleText, "");
theArticle.DoneReplacement("{{reqphoto}}", "template param(s)");
theArticle.ArticleHasAMajorChange();
}
theArticle.FinaliseEditSummary();
summary = theArticle.EditSummary;
return(theArticle.AlteredArticleText);
}