Wikipedia:Projekt DotNetWikiBot Framework/Innocent timebot/Verk utan cr-mall

Från Wikipedia
// Write your own bot scripts and functions in this file.
// Run "Compile & Run.bat" file - it will compile this file as executable and launch it.
// Compiled XML autodocumentation for DotNetWikiBot namespace is available as "Documentation.chm".

using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Xml;
using DotNetWikiBot;

class MyBot : Bot
{
	public void MyFunction1()
	{
		// Write your own function here
	}

	/// The entry point function. Start coding here.
	public static void Main()
	{
		// Here are some code examples:

		Site site = new Site("http://sv.wikisource.org", "Innocent timebot", "********");
				
		
		PageList pl = new PageList(site);
		PageList pl2 = new PageList(site);
		pl.FillAllFromCategory("CC-BY-SA-3.0");
		pl.FillAllFromCategory("PD-1923 utan angivet dödsår");
		pl.FillAllFromCategory("PD-Bibel");
		pl.FillAllFromCategory("PD-FN");
		pl.FillAllFromCategory("PD-Special");
		pl.FillAllFromCategory("PD-US-gov");
		pl.FillAllFromCategory("PD-anonym");
		pl.FillAllFromCategory("PD-anonym utan angivet publiceringsår");
		pl.FillAllFromCategory("PD-debatt");
		pl.FillAllFromCategory("PD-inte verkshöjd");
		pl.FillAllFromCategory("PD-myndighet");
		pl.FillAllFromCategory("PD-old");
		pl.FillAllFromCategory("Verk utan enhetlig licens");
		pl.FillAllFromCategory("PD-oklar");
		pl.FillAllFromCategory("Förgreningssidor");
		pl.RemoveRecurring();
		int antalsidormedmall = pl.Count();
		string[] namn = new string[antalsidormedmall];
		string sidamedlista = "";
		int i = 0;
		int j = 0;
		sidamedlista = "Lista uppdaterad av ~~~~ \n\n";
		
		pl2.FillFromAllPages("", 6, false, 1000);
		pl2.FillFromAllPages("", 108, false, 1000);
		pl2.FillFromAllPages("", 0, false,1000);
		pl2.RemoveRecurring();
		Console.WriteLine(pl2.Count());
		int t = -1;
		while( true )
		{
			t = pl2.Count();
			pl2.FillFromAllPages(pl2[pl2.Count()-1].title, 0, false, 1000);
			pl2.RemoveRecurring();
			Console.WriteLine(pl2.Count());
			if( t == pl2.Count())
				break;
		}
		
		foreach(Page myPage in pl)
		{
			namn[i] = myPage.title;
			if(namn[i].StartsWith("Diskussion:"))
				namn[i] = namn[i].Substring(11);
			if(namn[i].StartsWith("Fildiskussion:"))
				namn[i] = "Fil:"+namn[i].Substring(14);
			if(namn[i].StartsWith("Indexdiskussion:"))
				namn[i] = "Index:"+namn[i].Substring(16);
			i++;
		}
		foreach(Page myPage in pl2)
		{
			int var = -1;
			for(j = 0; j<antalsidormedmall ; j++ )
			{
				if(myPage.title == namn[j])
					var = 0;
			}
			if(var == -1)
			{
				Console.WriteLine(myPage.title);
				sidamedlista = sidamedlista+"# [[:"+myPage.title+"]] \n";
			}
		}
		
		Page p = new Page(site, "Wikisource:Lista över texter som saknar upphovsrättsmall");
		p.Load();
		p.text=sidamedlista;
		Bot.editComment = "Uppdaterar lista";
		p.Save();
		
		
	}
}