本文整理汇总了C#中DotNetWikiBot.Page.AddToCategory方法的典型用法代码示例。如果您正苦于以下问题:C# Page.AddToCategory方法的具体用法?C# Page.AddToCategory怎么用?C# Page.AddToCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetWikiBot.Page
的用法示例。
在下文中一共展示了Page.AddToCategory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReformatPage
public static void ReformatPage(string pageName)
{
Page page = new Page(newWiki, pageName);
page.Load();
string text = BBCodeToMediaWiki(page.text);
if (pageName.StartsWith("Mission Editor", true, System.Globalization.CultureInfo.CurrentCulture))
page.AddToCategory("Mission Editor");
page.Save(text, "Cleanup by DotNetWikiBot", false);
}
示例2: ConvertPage
public static void ConvertPage(string pageName, string newName, bool overwrite = false)
{
var db = new ZkDataContext();
ForumThread thread = db.ForumThreads.FirstOrDefault(x=> x.WikiKey == pageName);
if (thread == null)
{
Console.WriteLine("No ZK wiki page with name {0} found", pageName);
return;
}
string text = thread.ForumPosts.First().Text;
text = BBCodeToMediaWiki(text);
Page page = new Page(newWiki, newName);
page.Load();
bool update = false;
if (!page.IsEmpty())
{
if (!overwrite)
{
Console.WriteLine("Page already exists, exiting");
return;
}
else update = true;
}
if (newName.StartsWith("Mission Editor", true, System.Globalization.CultureInfo.CurrentCulture))
page.AddToCategory("Mission Editor");
page.Save(text, update ? "" : "Ported from ZK wiki by DotNetWikiBot", update);
}