本文整理匯總了C#中WikiFunctions.Parse.Parsers.Unicodify方法的典型用法代碼示例。如果您正苦於以下問題:C# Parsers.Unicodify方法的具體用法?C# Parsers.Unicodify怎麽用?C# Parsers.Unicodify使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WikiFunctions.Parse.Parsers
的用法示例。
在下文中一共展示了Parsers.Unicodify方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ExpandTemplate
/// <summary>
///
/// </summary>
/// <param name="ArticleText">The text of the article</param>
/// <param name="ArticleTitle">The title of the artlce</param>
/// <param name="Regexes"></param>
/// <param name="includeComment"></param>
/// <returns></returns>
public static string ExpandTemplate(string ArticleText, string ArticleTitle, Dictionary<Regex, string> Regexes, bool includeComment)
{
Parse.Parsers parsers = new Parse.Parsers();
foreach (KeyValuePair<Regex, string> p in Regexes)
{
MatchCollection uses = p.Key.Matches(ArticleText);
foreach (Match m in uses)
{
string call = m.Value;
string expandUri = Variables.URLLong + "api.php?action=expandtemplates&format=xml&title=" + Tools.WikiEncode(ArticleTitle) + "&text=" + HttpUtility.UrlEncode(call);
string result;
try
{
string respStr = Tools.GetHTML(expandUri);
Match m1 = ExpandTemplatesRegex.Match(respStr);
if (!m.Success) continue;
result = HttpUtility.HtmlDecode(m1.Groups[1].Value);
}
catch
{
continue;
}
bool skipArticle;
result = parsers.Unicodify(result, out skipArticle);
if (includeComment)
result = result + "<!-- " + call + " -->";
ArticleText = ArticleText.Replace(call, result);
}
}
return ArticleText;
}