当前位置: 首页>>代码示例>>C#>>正文


C# Article.AWBChangeArticleText方法代码示例

本文整理汇总了C#中Article.AWBChangeArticleText方法的典型用法代码示例。如果您正苦于以下问题:C# Article.AWBChangeArticleText方法的具体用法?C# Article.AWBChangeArticleText怎么用?C# Article.AWBChangeArticleText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Article的用法示例。


在下文中一共展示了Article.AWBChangeArticleText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessPage

        /// <summary>
        /// Fully processes a page, applying all needed changes
        /// </summary>
        /// <param name="theArticle">Page to process</param>
        /// <param name="mainProcess">True if the page is being processed for save as usual,
        /// otherwise (Re-parse in context menu, prefetch, etc) false</param>
        private void ProcessPage(Article theArticle, bool mainProcess)
        {
            bool process = true;
            TypoStats = null;

            #if DEBUG
            Variables.Profiler.Start("ProcessPage(\"" + theArticle.Name + "\")");
            #endif

            try
            {
                // Must be performed regardless of general fixes, otherwise there may be breakage
                theArticle.AWBChangeArticleText("Fixes for Unicode compatibility",
                                                Parser.FixUnicode(theArticle.ArticleText),
                                                true);

                if (NoParse.Contains(theArticle.Name))
                    process = false;

                if (!IgnoreNoBots &&
                    !Parsers.CheckNoBots(theArticle.ArticleText, TheSession.User.Name))
                {
                    theArticle.AWBSkip("Restricted by {{bots}}/{{nobots}}");
                    return;
                }

                Variables.Profiler.Profile("Initial skip checks");

                if (CModule.ModuleUsable)
                {
                    theArticle.SendPageToCustomModule(CModule.Module);
                    if (theArticle.SkipArticle) return;
                }

                Variables.Profiler.Profile("Custom module");

                if (ExtProgram.ModuleEnabled)
                {
                    theArticle.SendPageToCustomModule(ExtProgram);
                    if (theArticle.SkipArticle) return;
                }

                Variables.Profiler.Profile("External Program");

                if (Plugin.AWBPlugins.Count > 0)
                {
                    foreach (KeyValuePair<string, IAWBPlugin> a in Plugin.AWBPlugins)
                    {
                        theArticle.SendPageToPlugin(a.Value, this);
                        if (theArticle.SkipArticle) return;
                    }
                }
                Variables.Profiler.Profile("Plugins");

                // unicodify whole article
                if (process && chkUnicodifyWhole.Checked)
                {
                    theArticle.HideMoreText(RemoveText);
                    Variables.Profiler.Profile("HideMoreText");

                    theArticle.Unicodify(Skip.SkipNoUnicode, Parser);
                    Variables.Profiler.Profile("Unicodify");

                    theArticle.UnHideMoreText(RemoveText);
                    Variables.Profiler.Profile("UnHideMoreText");
                }

                // find and replace before general fixes
                if (chkFindandReplace.Checked)
                {
                    theArticle.PerformFindAndReplace(FindAndReplace, SubstTemplates, RplcSpecial,
                                                     chkSkipWhenNoFAR.Checked, chkSkipOnlyMinorFaR.Checked, false);

                    Variables.Profiler.Profile("F&R");

                    theArticle.DoFaRSkips(FindAndReplace);
                    if (theArticle.SkipArticle)
                        return;
                }

                // RegexTypoFix
                if (chkRegExTypo.Checked && RegexTypos != null && !BotMode && !Namespace.IsTalk(theArticle.NameSpaceKey))
                {
                    if (!NoRetf.Contains(theArticle.Name))
                    {
                        theArticle.PerformTypoFixes(RegexTypos, chkSkipIfNoRegexTypo.Checked);
                        Variables.Profiler.Profile("Typos");
                        TypoStats = RegexTypos.GetStatistics();
                    }
                    else if (chkSkipIfNoRegexTypo.Checked)
                        TheArticle.Trace.AWBSkipped("No typo fixes (Title blacklisted from RegExTypoFix Typo Fixing)");

                    if (theArticle.SkipArticle)
                    {
//.........这里部分代码省略.........
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:101,代码来源:Main.cs

示例2: Changes

        public void Changes()
        {
            Article a = new Article("A", "ABC");
            a.AWBChangeArticleText("test", "ABC D", false);
            Assert.IsFalse(a.OnlyWhiteSpaceChanged);
            Assert.IsFalse(a.OnlyCasingChanged);

            a = new Article("A", "ABC");
            a.AWBChangeArticleText("test", "AB C", false);
            Assert.IsTrue(a.OnlyWhiteSpaceChanged);
            Assert.IsTrue(a.OnlyWhiteSpaceAndCasingChanged);
            Assert.IsFalse(a.OnlyCasingChanged);
            Assert.IsFalse(a.NoArticleTextChanged);

            a = new Article("A", "ABC");
            a.AWBChangeArticleText("test", "ABc", false);
            Assert.IsTrue(a.OnlyCasingChanged);

            a = new Article("A", "ABC");
            a.AWBChangeArticleText("test", "ABC", false);
            Assert.IsTrue(a.NoArticleTextChanged);
            Assert.IsFalse(a.OnlyMinorGeneralFixesChanged);
        }
开发者ID:svn2github,项目名称:awb,代码行数:23,代码来源:MiscellaneousTests.cs


注:本文中的Article.AWBChangeArticleText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。