Hoppa till innehållet

Wikipedia:Projekt DotNetWikiBot Framework/GameOnBot/Syntaxfel/064 - Description same as link

Från Wikipedia
//Originally made by sv:Användare:GameOn in 2011
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Xml;
using DotNetWikiBot;
using System.Threading;
using System.Net;
using System.Web;

class MyBot : Bot
{
	public static void Main()
	{
		Site     site                = new Site(wiki, username, password);
		String   editCommentStr      = "Syntaxfix 64, Enlace igual que el texto";
		String   orgStr;
		PageList pl                  = new PageList(site);
		string[] linksStr;

		pl.FillFromFile("test1.txt");
		pl.FilterNamespaces(new int[] {0});
		pl.RemoveRecurring();
		foreach(Page myPage in pl)
		{
			myPage.Load();
			orgStr = myPage.text;
			
			linksStr = myPage.GetAllLinks();
			foreach(string tmpStr in linksStr)
				myPage.text = myPage.text.Replace("[[" + tmpStr + "|" + tmpStr + "]]", "[[" + tmpStr + "]]");
			if(myPage.text != orgStr)
			{
				myPage.Save(myPage.text, editCommentStr, true);
				Thread.Sleep(60000);
			}
		}
	}
}