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


C# Article.Disambiguate方法代码示例

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


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

示例1: ProcessPage


//.........这里部分代码省略.........
                        if (theArticle.NameSpaceKey == Namespace.UserTalk)
                        {
                            if (!UserTalkWarningsLoaded)
                            {
                                LoadUserTalkWarnings();
                                Variables.Profiler.Profile("loadUserTalkWarnings");
                            }

                            theArticle.PerformUserTalkGeneralFixes(RemoveText, UserTalkTemplatesRegex,
                                                                   Skip.SkipNoUserTalkTemplatesSubstd);
                        }
                        else if (theArticle.CanDoTalkGeneralFixes)
                        {
                            theArticle.PerformTalkGeneralFixes(RemoveText);
                        }
                        Variables.Profiler.Profile("Talk Genfixes");
                    }
                }

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

                    theArticle.DoFaRSkips(FindAndReplace);

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

                    if (theArticle.SkipArticle) return;
                }

                // append/prepend text
                if (chkAppend.Checked)
                {
                    // customized number of newlines
                    string newlines = "";
                    for (int i = 0; i < (int)udNewlineChars.Value; i++)
                        newlines += "\n";

                    if (rdoAppend.Checked)
                        theArticle.AWBChangeArticleText("Appended your message",
                                                        theArticle.ArticleText + newlines + Tools.ApplyKeyWords(theArticle.Name, txtAppendMessage.Text), false);
                    else
                        theArticle.AWBChangeArticleText("Prepended your message",
                                                        Tools.ApplyKeyWords(theArticle.Name, txtAppendMessage.Text) + newlines + theArticle.ArticleText, false);

                    if (chkAppendMetaDataSort.Checked)
                        theArticle.PerformMetaDataSort(Parser);
                }

                Variables.Profiler.Profile("Append Text");

                // replace/remove/comment out images
                if (cmboImages.SelectedIndex != 0)
                {
                    theArticle.UpdateImages((WikiFunctions.Options.ImageReplaceOptions)cmboImages.SelectedIndex,
                                            txtImageReplace.Text, txtImageWith.Text, chkSkipNoImgChange.Checked);
                    if (theArticle.SkipArticle)
                        return;
                }

                Variables.Profiler.Profile("Images");

                // disambiguation
                if (!preParseModeToolStripMenuItem.Checked && chkEnableDab.Checked && txtDabLink.Text.Trim().Length > 0 &&
                    txtDabVariants.Text.Trim().Length > 0)
                {
                    if (theArticle.Disambiguate(TheSession, txtDabLink.Text.Trim(), txtDabVariants.Lines, BotMode,
                                                (int)udContextChars.Value, chkSkipNoDab.Checked))
                    {
                        if (theArticle.SkipArticle)
                            return;
                    }
                    else
                    {
                        Abort = true;
                        Stop();
                        return;
                    }
                }
                Variables.Profiler.Profile("Disambiguate");
            }
            catch (Exception ex)
            {
                ErrorHandler.Handle(ex);

                // don't remove page over regex error – page itself is not at fault
                if (!ex.StackTrace.Contains("System.Text.RegularExpressions"))
                    theArticle.Trace.AWBSkipped("Exception:" + ex.Message);
                else
                    Skippable = false;
                Stop();
                StopDelayedAutoSaveTimer();
            }
            finally
            {
                Variables.Profiler.Flush();
            }
        }
开发者ID:svn2github,项目名称:autowikibrowser,代码行数:101,代码来源:Main.cs


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