/// 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();
		/**/
	}
 /// <summary>Gets page titles and page texts from all ".txt" files in the specified
 /// directory (folder). Each file becomes a page. Page titles are constructed from
 /// file names. Page text is read from file contents. If any Unicode numeric codes
 /// (also known as numeric character references or NCRs) of the forbidden characters
 /// (forbidden in filenames) are recognized in filenames, those codes are converted
 /// to characters (e.g. "&#x7c;" is converted to "|").</summary>
 /// <param name="dirPath">The path and name of a directory (folder)
 /// to load files from.</param>
 public void FillAndLoadFromFiles(string dirPath)
 {
     foreach (string fileName in Directory.GetFiles(dirPath, "*.txt")) {
         Page p = new Page(site, Path.GetFileNameWithoutExtension(fileName));
         p.title = p.title.Replace("&#x22;", "\"");
         p.title = p.title.Replace("&#x3c;", "<");
         p.title = p.title.Replace("&#x3e;", ">");
         p.title = p.title.Replace("&#x3f;", "?");
         p.title = p.title.Replace("&#x3a;", ":");
         p.title = p.title.Replace("&#x5c;", "\\");
         p.title = p.title.Replace("&#x2f;", "/");
         p.title = p.title.Replace("&#x2a;", "*");
         p.title = p.title.Replace("&#x7c;", "|");
         p.LoadFromFile(fileName);
         pages.Add(p);
     }
 }