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


C# Page.Save方法代码示例

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


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

示例1: exec

 public static void exec()
 {
     string[] line = System.IO.File.ReadAllLines("list");
     List<string> ignorelist = new List<string>();
     if (System.IO.File.Exists("resultsig"))
     {
         ignorelist.AddRange (System.IO.File.ReadAllLines("resultsig"));
     }
     if (System.IO.File.Exists("results"))
     {
         ignorelist.AddRange (System.IO.File.ReadAllLines("results"));
     }
     int processed = 1;
     foreach (string c in line)
     {
         if (ignorelist.Contains(c))
         {
             continue;
         }
         try
         {
             Page afc = new Page(MainClass.en, "Wikipedia talk:" + c);
             afc.Load();
             if ( afc.text == null ||
                 afc.text.Contains("REDIRECT") ||
                 afc.text.Contains("{{AFC") ||
                 afc.text.Contains("{{WPAFC") ||
                               afc.text == "" ||
                 afc.text.Contains("[[Category:AfC_submissions_with_missing_AfC_template]]")
                              )
             {
                 MainClass.DebugLog("OK:" + c);
                 System.IO.File.AppendAllText("resultsig", c + "\n");
             }
             else
             {
                 MainClass.DebugLog("Category missing:"  + c);
                 afc.text = afc.text + "\n[[Category:AfC_submissions_with_missing_AfC_template]]";
                 afc.Save(afc.text, "Bot: inserting [[Category:AfC_submissions_with_missing_AfC_template]]", false);
                 processed++;
                 System.IO.File.AppendAllText("results", c + "\n");
                 if (processed > 100)
                 {
                     MainClass.DebugLog("Finished for today");
                     return;
                 }
             }
         }
         catch (Exception fail)
         {
             Console.WriteLine(fail.ToString());
             System.IO.File.AppendAllText("errors", c + Environment.NewLine);
         }
     }
     MainClass.Log("end");
 }
开发者ID:WPAFC,项目名称:wikibots,代码行数:56,代码来源:Task1.cs

示例2: Main

	/// The entry point function. Start coding here.
	public static void Main()
	{
		// Compiled documentation is available in Documentation.chm file.

		// A very compehensive DotNetWikiBot usage examples can be found
		// in unit testing file called DebugBot.cs:
		// http://sourceforge.net/p/dotnetwikibot/svn/HEAD/tree/DebugBot.cs

		// Bot scripts repository is being created at
		// https://sourceforge.net/apps/mediawiki/dotnetwikibot/index.php?title=BSR
		// You are welcome to share your scripts.

		// And here you can find some basic usage examples:

		Site site = new Site("https://en.wikipedia.org", "YourBotLogin", "YourBotPassword");
		//Site site = new Site("http://mywikisite.com", "YourBotLogin", "YourBotPassword");
		//Site site = new Site("https://sourceforge.net/apps/mediawiki/YourProjectName/",
								//"YourSourceForgeLogin", "YourSourceForgePassword");

		site.ShowNamespaces();
		Page p = new Page(site, "Wikipedia:Sandbox");
		p.LoadWithMetadata();
		if (p.Exists())
			Console.WriteLine(p.text);
		p.SaveToFile("MyArticles\\file.txt");
		p.LoadFromFile("MyArticles\\file.txt");
		p.ResolveRedirect();
		Console.WriteLine(p.GetNamespace());
		p.text = "new text";
		site.defaultEditComment = "saving test";
		site.minorEditByDefault = true;
		p.Save();

		/**
		string[] arr = {"Art", "Poetry", "Cinematography", "Camera", "Image"};
		PageList pl = new PageList(site, arr);
		pl.LoadWithMetadata();
		pl.FillFromAllPages("Sw", 0, true, 100);
		pl.SaveTitlesToFile("MyArticles\\list.txt");
		pl.FillFromFile("MyArticles\\list.txt");
		pl.FillFromCategory("Category:Cinematography");
		pl.FillFromLinksToPage("Cinematography");
		pl.RemoveEmpty();
		pl.RemoveDisambigs();
		pl.ResolveRedirects();
		Console.WriteLine(pl[2].text);
		pl[1].text = "#REDIRECT [[Some Page]]";
		pl.FilterNamespaces(new int[] {0,3});
		pl.RemoveNamespaces(new int[] {2,4});
		pl.Clear();
		site.defaultEditComment = "my edit comment";
		site.minorEditByDefault = true;
		pl.Save();
		/**/
	}
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:56,代码来源:BotScript.cs

示例3: ProcessPage

        protected override void ProcessPage(Page p, EditStatus edit)
        {
            if (p.GetNamespace() != 0)
                return;
            p.Load();

            //Nur Seiten mit Vorlage:Infobox NSC
            if (p.GetAllTemplates().All(t => t.Title.ToLower() != "infobox nsc")) return;

            //Nur Seiten, die eine Unterseite mit Angeboten haben...
            var m = Regex.Match(p.text, "\\{\\{:" + p.title + "/([^}]+)}}");
            if (!m.Success) return;

            var subpageTitle = m.Groups[1].Value;

            var subpage = new Page(p.site, p.title + "/" + subpageTitle);
            subpage.Load();
            if (!subpage.Exists())
            {
                p.text = p.text.Replace(m.Value, "");
                edit.EditComment = "Verweis auf nicht vorhandene Angebots-Unterseite „" + subpage.title + "“ entfernt";
                edit.Save = true;
            }
            else
            {
                var pl2 = new PageList(p.site);
                pl2.FillFromLinksToPage(subpage.title);
                if (pl2.Count() > 1) return;

                var subpageContent = Regex.Replace(subpage.text, "<noinclude>.*?</noinclude>", "").Trim();

                p.text = p.text.Replace(m.Value, subpageContent);

                subpage.text = "{{Löschantrag|[Bot] In den Hauptartikel „[[" + p.title + "]]“ verschoben}}\n" +
                               subpage.text;
                subpage.Save("[Bot] In Hauptartikel „[[" + p.title + "]]“ verschoben", true);

                edit.EditComment = "Angebot von „" + subpage.title + "“ in den Hauptartikel verschoben";
                edit.Save = true;
            }
        }
开发者ID:knabbi,项目名称:GW2WBot,代码行数:41,代码来源:AngebotSubpageToMainarticleJob.cs

示例4: 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);
 }
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:9,代码来源:WikiPortingMW.cs

示例5: 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);
        }
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:30,代码来源:WikiPortingMW.cs

示例6: AddNavbox

 public static void AddNavbox(Page page, string template)
 {
     string text = page.text;
     if (page.GetTemplates(false, false).Contains(template))
     {
         Console.WriteLine("Page {0} already has template {1}", page.title, template);
         return;
     }
     page.AddTemplate("{{" + template + "}}");
     page.Save(text, "Infobox added by DotNetWikiBot", true);
 }
开发者ID:DeinFreund,项目名称:Zero-K-Infrastructure,代码行数:11,代码来源:WikiPortingMW.cs

示例7: schreibDiskussion

 public void schreibDiskussion(string _text)
 {
     Page p = new Page(site, "Benutzer Diskussion:" + name);
     p.LoadEx();
     p.text+="\n"+_text;
     p.Save();
 }
开发者ID:BackupTheBerlios,项目名称:wikifighter-svn,代码行数:7,代码来源:DotNetWikiBot.cs

示例8: SavePage

 private static void SavePage(Page page, string editSummary)
 {
     page.Save(editSummary, /*isMinorEdit*/false);
     Console.WriteLine(editSummary);
 }
开发者ID:wikigit,项目名称:Picasa-Review-Bot,代码行数:5,代码来源:Program.cs

示例9: DoStuff

        public static void DoStuff()
        {
            string username = "";
            string password = "";

            Console.WriteLine("Enter wiki username: ");
            username = Console.ReadLine();
            Console.WriteLine("Enter wiki password: ");
            password = Console.ReadLine();
            password = password.Trim();

            newWiki = new Site(WIKI_URL, username, password);

            int count = 0;  // increment this when we actually create a page
            var files = new System.Collections.Generic.List<string>(Directory.GetFiles(@"G:\zkwiki\output\markup"));
            files = files.Shuffle();
            foreach (string path in files)
            {
                string unitname = Path.GetFileNameWithoutExtension(path);
                unitname = unitname.Replace("&#47;", "/");
                var page = new Page(newWiki, unitname);
                page.Load();
                if (page.Exists())
                {
                    // do nothing
                }
                else
                {
                    var text = File.ReadAllText(path);
                    Console.WriteLine("-- Making page {0} --", unitname);
                    page.Save(text, "Created page from unitguide builder export", false);
                    count++;
                    //if (count >= 20) break;
                }
            }

            string[,] toPort = 
            {
                //{"MissionEditorCompatibility", "Mission Editor game compatibility"},
                //{"MissionEditorStartPage", "Mission Editor"},
                //{"MissionEditorWINE", "Mission Editor in WINE"},
                //{"FactoryOrdersTutorial", "Mission Editor Factory Orders Tutorial"},
                //{"MissionEditorTutorial", "Mission Editor Tutorial"},
                //{"MissionEditorCutsceneTutorial", "Mission Editor Cutscenes Tutorial"}
            };
            for (int i=0; i<toPort.GetLength(0); i++)
            {
                ConvertPage(toPort[i, 0], toPort[i, 1], false);
            }

            string[] toReformat =
            {
                //"Mission Editor Cutscenes Tutorial"
            };
            for (int i = 0; i < toReformat.GetLength(0); i++)
            {
                ReformatPage(toReformat[i]);
            }
        }
开发者ID:GoogleFrog,项目名称:Zero-K-Infrastructure,代码行数:59,代码来源:WikiPortingMW.cs


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