PluginIHaveFinished() private method

private PluginIHaveFinished ( SkipResults result, string pluginName ) : void
result SkipResults
pluginName string
return void
コード例 #1
0
        protected internal bool ProcessTalkPage(Article article, Classification classification, Importance importance,
                                                bool forceNeedsInfobox, bool forceNeedsAttention, bool removeAutoStub,
                                                ProcessTalkPageMode processTalkPageMode, bool addReqPhotoParm)
        {
            bool badTemplate = false;
            bool res         = false;

            TheArticle = article;

            if (SkipIfContains())
            {
                article.PluginIHaveFinished(SkipResults.SkipRegex, PluginShortName);
            }
            else
            {
                // MAIN
                string originalArticleText = article.AlteredArticleText;

                Template = new Templating();
                article.AlteredArticleText = MainRegex.Replace(article.AlteredArticleText, MatchEvaluator);

                if (Template.BadTemplate)
                {
                    badTemplate = true;
                }
                else if (Template.FoundTemplate)
                {
                    // Even if we've found a good template bizarrely the page could still contain a bad template too
                    if (SecondChanceRegex.IsMatch(article.AlteredArticleText) || TemplateFound())
                    {
                        badTemplate = true;
                    }
                }
                else
                {
                    if (SecondChanceRegex.IsMatch(originalArticleText))
                    {
                        badTemplate = true;
                    }
                    else
                    {
                        TemplateNotFound();
                    }
                }

                // OK, we're in business:
                res = true;
                if (HasReqPhotoParam && addReqPhotoParm)
                {
                    ReqPhoto();
                }

                ProcessArticleFinish();
                if (processTalkPageMode != ProcessTalkPageMode.Normal)
                {
                    ProcessArticleFinishNonStandardMode(classification, importance, forceNeedsInfobox,
                                                        forceNeedsAttention, removeAutoStub, processTalkPageMode);
                }

                if (TheArticle.ProcessIt)
                {
                    TemplateWritingAndPlacement();
                }
                else
                {
                    article.AlteredArticleText = originalArticleText;
                    article.PluginIHaveFinished(SkipResults.SkipNoChange, PluginShortName);
                }
            }

            if (badTemplate)
            {
                article.PluginIHaveFinished(SkipResults.SkipBadTag, PluginShortName);
                // TODO: We could get the template placeholder here
            }

            TheArticle = null;
            return(res);
        }
コード例 #2
0
ファイル: PluginBase.cs プロジェクト: reedy/AutoWikiBrowser
        protected internal bool ProcessTalkPage(Article article, Classification classification, Importance importance,
            bool forceNeedsInfobox, bool forceNeedsAttention, bool removeAutoStub,
            ProcessTalkPageMode processTalkPageMode, bool addReqPhotoParm)
        {
            bool badTemplate = false;
            bool res = false;

            TheArticle = article;

            if (SkipIfContains())
            {
                article.PluginIHaveFinished(SkipResults.SkipRegex, PluginShortName);
            }
            else
            {
                // MAIN
                string originalArticleText = article.AlteredArticleText;

                Template = new Templating();
                article.AlteredArticleText = MainRegex.Replace(article.AlteredArticleText, MatchEvaluator);

                if (Template.BadTemplate)
                {
                    badTemplate = true;
                }
                else if (Template.FoundTemplate)
                {
                    // Even if we've found a good template bizarrely the page could still contain a bad template too
                    if (SecondChanceRegex.IsMatch(article.AlteredArticleText) || TemplateFound())
                    {
                        badTemplate = true;
                    }
                }
                else
                {
                    if (SecondChanceRegex.IsMatch(originalArticleText))
                    {
                        badTemplate = true;
                    }
                    else
                    {
                        TemplateNotFound();
                    }
                }

                // OK, we're in business:
                res = true;
                if (HasReqPhotoParam && addReqPhotoParm)
                {
                    ReqPhoto();
                }

                ProcessArticleFinish();
                if (processTalkPageMode != ProcessTalkPageMode.Normal)
                {
                    ProcessArticleFinishNonStandardMode(classification, importance, forceNeedsInfobox,
                        forceNeedsAttention, removeAutoStub);
                }

                if (TheArticle.ProcessIt)
                {
                    TemplateWritingAndPlacement();
                }
                else
                {
                    article.AlteredArticleText = originalArticleText;
                    article.PluginIHaveFinished(SkipResults.SkipNoChange, PluginShortName);
                }
            }

            if (badTemplate)
            {
                article.PluginIHaveFinished(SkipResults.SkipBadTag, PluginShortName);
                // TODO: We could get the template placeholder here
            }

            TheArticle = null;
            return res;
        }