Пример #1
0
 public ReplacementJob(Site site,
                       IDictionary<string, string> replacements,
                       IDictionary<Regex, string> regexReplacements,
                       GeneralExtensions.Placeholder placeholders)
     : base(site)
 {
     Replacements = replacements;
     RegexReplacements = regexReplacements;
     Placeholders = placeholders;
 }
Пример #2
0
        static void Main(string[] args)
        {
            foreach (var line in File.ReadLines("config.txt"))
            {
                var indexOfSep = line.IndexOf('=');
                var key = line.Substring(0,indexOfSep).Trim();
                var val = line.Substring(indexOfSep + 1).Trim();

                if (key == "user") User = val;
                if (key == "pass") Pass = val;
                if (key == "apiAuthentication") ApiAuthentication = val;
            }

            if (string.IsNullOrEmpty(User) || string.IsNullOrEmpty(Pass) || string.IsNullOrEmpty(ApiAuthentication))
            {
                Console.WriteLine("Incomplete config");
                return;
            }

            var statusApi = new StatusApi();
            statusApi.SetStatus(false);

            var s = new Site("http://wiki-de.guildwars2.com/wiki/", User, Pass);

            if (args.Contains("-generatePagelist") || !File.Exists("pagelist.txt"))
            {
                Console.WriteLine("Generating pagelist...");
                var pagelist = new PageList(s);
                pagelist.FillFromCategoryTree("Guild Wars 2");
                pagelist.SaveTitlesToFile("pagelist.txt");
            }

            try
            {
                Run(s);
            }
            finally
            {
                statusApi.SetStatus(false);
            }
        }
Пример #3
0
 /// <summary>This constructor creates Page object without title using most recently
 /// created Site object.</summary>
 /// <returns>Returns Page object.</returns>
 public Page()
 {
     this.site = Bot.GetMostRecentSiteObject();
 }
 public LinkAttributeInItemDescriptionJob(Site site)
     : base(site)
 {
 }
Пример #5
0
 /// <summary>This constructor creates Page object with specified title. Site object
 /// with default properties is created internally and logged in. Constructing
 /// new Site object is too slow, don't use this constructor needlessly.</summary>
 /// <param name="title">Page title as string.</param>
 /// <returns>Returns Page object.</returns>
 public Page(string title)
 {
     this.site = new Site();
     this.title = title;
 }
Пример #6
0
 /// <summary>This constructor creates empty Page object without title. Site object with
 /// default properties is created internally and logged in. Constructing new Site object
 /// is too slow, avoid using this constructor needlessly.</summary>
 /// <returns>Returns Page object.</returns>
 public Page()
 {
     this.site = new Site();
 }
Пример #7
0
 /// <summary>This constructor creates empty PageList object with specified
 /// Site object.</summary>
 /// <param name="site">Site object, it must be constructed beforehand.</param>
 /// <returns>Returns the PageList object.</returns>
 public PageList(Site site)
 {
     this.site = site;
 }
Пример #8
0
 /// <summary>This constructor creates Page object with specified title and specified
 /// Site object. This is preferable constructor. When constructed, new Page object doesn't
 /// contain text. Use Load() method to get text from live wiki. Or use LoadEx() to get
 /// both text and metadata via XML export interface.</summary>
 /// <param name="site">Site object, it must be constructed beforehand.</param>
 /// <param name="title">Page title as string.</param>
 /// <returns>Returns Page object.</returns>
 public Page(Site site, string title)
 {
     this.title = title;
     this.site = site;
 }
Пример #9
0
 public AufgestiegenerSchmuckJob(Site site)
     : base(site)
 {
 }
        public static void DoStuff()
        {
            string username = "";
            string password = "";

            Console.WriteLine("Enter wiki username: "******"Enter wiki password: "******"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]);
            }
        }
Пример #11
0
 public ReplacementJob(Site site)
     : this(site, new Dictionary<string, string>(), new Dictionary<Regex, string>())
 {
 }
Пример #12
0
 public ReplacementJob(Site site, IDictionary<string, string> replacements, IDictionary<Regex, string> regexReplacements)
     : this(site, replacements, regexReplacements, GeneralExtensions.Placeholder.Default)
 {
 }
Пример #13
0
        private void Login()
        {
            this.Hide();
            loginForm = new FormLogin();
            if (loginForm.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
            {
                Application.Exit();
                return;
            }

            loadingDialog = new LoadingDialog();
            loadingDialog.Message = "Logging in...";
            loadingDialog.Show(this);
            this.Enabled = false;
            Thread loginThread = new Thread(new ThreadStart(delegate()
            {
                try
                {
                    errorMessage = null;
                    site = new Site("http://en.wikipedia.org", loginForm.Username, loginForm.Password);
                }
                catch (WikiBotException ex)
                {
                    if (ex.Message.Contains("Login failed"))
                    {
                        errorMessage = "Login failed. Check your username and password and try again.";
                    }
                    else
                    {
                        errorMessage = "Encountered error: " + ex.Message;
                    }
                }
                this.Invoke(new MethodInvoker(CompleteLogin));
            }));
            loginThread.Start();
        }
Пример #14
0
        void LoadPages()
        {
            //site = new Site("http://localhost/index.php/", "ZenithBot", "Bot");
            site = new Site("http://en.wikipedia.org/", "HNCluster", "csce470");
            Invoke(CheckSiteLoaded);

            pageList = new PageList(site);
            //pageList.FillFromFile(@"ComputerScienceWikipediaPagesList");
            pageList.FillAndLoadFromXMLDump(@"Wikipedia-ComputerScience.xml");

            wikiCollection.LoadFromPageList(pageList);
            Invoke(IncrementPagesLoadedByVal, wikiCollection.wikiPages.Count);
            pagesLoaded += wikiCollection.wikiPages.Count;

            if (InvokeRequired)
            {
                Invoke(UpdateText);
            }
            else
            {
                UpdateTextMethod();
            }

            Invoke(CheckTitlesLoaded);
            wikiCollection.ExtractTokens();
            Invoke(CheckTokenized);
            if (InvokeRequired)
            {
                Invoke(UpdateText);
            }
            else
            {
                UpdateTextMethod();
            }
            /*
            int num = 100;

            for (int i = 0; i < pageList.pages.Count; ++i)
            {
                if (i + num < pageList.pages.Count)
                {
                    Parallel.For(i, i + num, n =>
                    {
                        pageList.pages[n].Load();
                    });
                    i += num - 1;
                    pagesLoaded += num;
                    Invoke(IncrementPagesLoadedByVal, num);
                }
                else
                {
                    Parallel.For(i, pageList.pages.Count, n =>
                    {
                        pageList.pages[n].Load();
                    });
                    i += num - 1;
                    pagesLoaded += pageList.pages.Count - i;
                    Invoke(IncrementPagesLoadedByVal, pageList.pages.Count - i);
                }

            }*/
            /*
            foreach (Page page in pageList)
            {
                page.Load();
                if (numericUpDown1.Value == 0)
                {
                    Invoke(AddPageText, new object[] { pageList[0] });
                }
                pagesLoaded += 1;
                Invoke(IncrementPagesLoaded);
                //Application.DoEvents();
            }*/
        }
Пример #15
0
 public FixParameterfehlerJob(Site site)
     : base(site)
 {
 }
        public static void DoStuff()
        {
            string username = "";
            string password = "";

            Console.WriteLine("Enter wiki username: "******"Enter wiki password: "******"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], true);
            }

            string[] toReformat =
            {
                //"Mission Editor Cutscenes Tutorial"
            };
            for (int i = 0; i < toReformat.GetLength(0); i++)
            {
                ReformatPage(toReformat[i]);
            }
        }
 public RemoveUeberfluessigeParameter(Site site)
     : base(site)
 {
 }
 public AngebotSubpageToMainarticleJob(Site site)
     : base(site)
 {
 }
Пример #19
0
        static void Main(string[] args)
        {
            Site site = new Site("http://commons.wikimedia.org", args[0], args[1]);
            while (true)
            {
                PageList list = new PageList(site);
                list.FillAllFromCategory("Category:Rotate270");
                foreach (Page page in list)
                {
                    if (!page.title.ToLower().EndsWith(".jpg")) continue;
                    page.Load();
                    if (!page.text.Contains("{{rotate"))
                    {
                        page.text = "{{rotate|270}}\n" + page.text;
                        page.Save("Add {{rotate|270}} tag since it's in Category:Rotate270", /*isMinorEdit*/false);
                    }
                }

                list = new PageList(site);
                list.FillAllFromCategory("Category:Images requiring rotation");
                foreach (Page page in list)
                {
                    Regex regex = new Regex(@"\{\{Rotate\|nobot=true\|reason='''Reason''': corrupt JPEG file.\|([^}]*)\}\}", RegexOptions.IgnoreCase);
                    page.Load();
                    Match m = regex.Match(page.text);
                    if (m.Success)
                    {
                        page.text = regex.Replace(page.text, "{{Rotate|" + m.Groups[1].Value + "}}");
                        page.Save("Undo mistagging by [[User:Rotatebot]], JPEG should not be corrupt", /*isMinorEdit*/false);
                    }
                }

                list = new PageList(site);
                list.FillAllFromCategory("Category:Images requiring rotation by bot");
                try
                {
                    foreach (Page page in list)
                    {
                        if (!page.title.ToLower().EndsWith(".jpg")) continue;
                        page.Load();
                        MatchCollection matches = new Regex(@"\{\{rotate\|([0-9]+)\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                        if (matches.Count == 0)
                        {
                            matches = new Regex(@"\{\{rotate\|degree=([0-9]+)\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                            if (matches.Count == 0)
                            {
                                matches = new Regex(@"\{\{rotate\|([0-9]+)\|[^}]*\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                                if (matches.Count == 0)
                                {
                                    continue;
                                }
                            }
                        }
                        if (matches.Count > 1)
                        {
                            while (matches.Count > 1)
                            {
                                page.text = page.text.Remove(matches[0].Index, matches[0].Length);
                                matches = new Regex(@"\{\{rotate\|([0-9]+)\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                                if (matches.Count == 0)
                                {
                                    matches = new Regex(@"\{\{rotate\|degree=([0-9]+)\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                                    if (matches.Count == 0)
                                    {
                                        matches = new Regex(@"\{\{rotate\|([0-9]+)\|[^}]*\}\}", RegexOptions.IgnoreCase).Matches(page.text);
                                    }
                                }
                            }
                            page.Save("Remove redundant rotate tags", /*isMinorEdit*/false);
                        }

                        Match m = matches[0];
                        int degrees = int.Parse(m.Groups[1].Value);
                        page.DownloadImage("tempin.jpg");
                        File.Delete("tempout.jpg");
                        ProcessStartInfo info = new ProcessStartInfo(@"..\..\jpegtran.exe", "-rotate " + degrees + " tempin.jpg tempout.jpg");
                        info.CreateNoWindow = true;
                        info.UseShellExecute = false;
                        Process p = Process.Start(info);
                        p.WaitForExit();
                        if (File.Exists("tempout.jpg"))
                        {
                            page.UploadImage("tempout.jpg", "Losslessly rotate by " + degrees + " degrees per request using jpegtran", "", "", "");
                            page.Load();
                            page.text = page.text.Replace(m.Value + "\n", "");
                            page.text = page.text.Replace(m.Value, "");
                            page.text = page.text.Replace("[[Category:Rotate270]]\n", "");
                            page.text = page.text.Replace("[[Category:Rotate270]]", "");
                            page.Save("Done with rotation by " + degrees + " degrees, removing tag", /*isMinorEdit*/false);
                        }
                    }
                    System.Threading.Thread.Sleep(new TimeSpan(0, 2, 0));
                }
                catch (Exception e)
                {
                    Console.WriteLine("Caught exception: " + e.Message + e.StackTrace);
                }
            }
        }
Пример #20
0
        public override void Load()
        {
            try
            {
                ch = core.getChannel(RequestLabs.RequestCh);
                if (ch == null)
                {
                    Log("CRITICAL: the bot isn't in " + RequestLabs.RequestCh + " unloading requests", true);
                    return;
                }
                RequestCache.Load();
                notifications = new Thread(Run);
                notifications.Start();
                Site wikitech = new Site("https://wikitech.wikimedia.org", "wmib", "");
                while (true)
                {
                    try
                    {
                        List<string> shell = new List<string>();
                        List<string> tooldata = new List<string>();
                        PageList requests = new PageList(wikitech);
                        requests.FillAllFromCategory("Shell Access Requests");
                        foreach (Page page in requests)
                        {
                            string title = page.title.Replace("Shell Request/", "");
                            if (RequestCache.Contains(title))
                            {
                                continue;
                            }
                            page.Load();
                            if (!Matches(page.text))
                            {
                                RequestCache.Insert(title);
                                lock (Shell)
                                {
                                    // this one was already processed
                                    RequestLabs previous = Contains(title);
                                    if (previous != null)
                                    {
                                        Shell.Remove(previous);
                                    }
                                }
                                continue;
                            }
                            else
                            {
                                if (!shell.Contains(title))
                                {
                                    shell.Add(title);
                                }
                                lock (Shell)
                                {
                                    if (Contains(title) == null)
                                    {
                                        Shell.Add(new RequestLabs(title));
                                    }
                                }
                            }
                        }

                        requests = new PageList(wikitech);
                        requests.FillAllFromCategory("Tools_Access_Requests");
                        foreach (Page page in requests)
                        {
                            string title = page.title.Replace("Nova Resource:Tools/Access Request/", "");
                            if (RequestCache.ContainsLabs(title))
                            {
                                continue;
                            }
                            page.Load();
                            if (!(Matches(page.text)))
                            {
                                RequestCache.InsertLabs(title);
                                lock (Tools)
                                {
                                    // this one was already processed
                                    RequestLabs previous = ContainsLabs(title);
                                    if (previous != null)
                                    {
                                        Tools.Remove(previous);
                                    }
                                }
                                continue;
                            }
                            else
                            {
                                if (!tooldata.Contains(title))
                                {
                                    tooldata.Add(title);
                                }
                                lock (Tools)
                                {
                                    if (ContainsLabs(title) == null)
                                    {
                                        Tools.Add(new RequestLabs(title));
                                    }
                                }
                            }
                        }
                        Thread.Sleep(60000);
                    }
                    catch (ThreadAbortException)
                    {
                        notifications.Abort();
                        return;
                    }
                    catch (Exception fail)
                    {
                        handleException(fail);
                    }
                }
            }
            catch (Exception fail)
            {
                handleException(fail);
                notifications.Abort();
            }
        }
Пример #21
0
        static void Main(string[] args)
        {
            username = args[0];
            password = args[1];

            Bot.unsafeHttpHeaderParsingUsed = 0;
            Site site = new Site(wikiSiteUrl, username, password);
            while (true)
            {
                int totalPagesProcessed = 0;
                try
                {
                    PageList pageList = new PageList(site);
            #if true
                    if (catScanning != null)
                        pageList.FillFromCategory(catScanning);
                    else
                        pageList.FillFromSearchResults(searchScanning, int.MaxValue);
            #endif

                    string failureReason = null;
                    foreach (Page page in pageList)
                    {
                        if (resumeAfter != null)
                        {
                            if (page.title == resumeAfter) resumeAfter = null;
                            continue;
                        }

                        totalPagesProcessed++;
                        if (!page.title.StartsWith("File:"))
                        {
                            continue;
                        }
                        while (true)
                        {
                            try
                            {
                                page.Load();

                                if (tagCompletedRegex.Match(page.text).Success)
                                {
                                    break;
                                }

                                if (!tagRegex.Match(page.text).Success &&
                                    !page.text.ToLower().Contains("{{picasareviewunnecessary}}") &&
                                    !page.text.ToLower().Contains("user:picasa review bot/reviewed-error"))
                                {
                                    Regex licenseReviewRegex = new Regex("{{LicenseReview\\|[^|]*\\|([^|]*)\\|([^}]*)}}");
                                    Match m;
                                    if ((m = licenseReviewRegex.Match(page.text)).Success)
                                    {
                                        page.text = licenseReviewRegex.Replace(page.text, "{{picasareview|" + m.Groups[1].ToString() + "|" + m.Groups[2].ToString() + "}}");
                                        SavePage(page, "Converting old LicenseReview tag into picasareview tag");
                                        break;
                                    }
                                    else
                                    {
                                        page.text += "\n{{picasareview}}\n";
                                    }
                                }

                                bool success = false;
                                do
                                {
                                    File.Delete("temp_wiki_image");
                                    File.Delete("temp_picasa_image");
                                    File.Delete("temp_picasa_image_full");

                                    string licenseName, mediaUrl;

                                    bool reviewUnnecessary = false;
                                    if (CheckIfReviewUnnecessary(page))
                                    {
                                        // Keep running so we can upload the original version, break out later
                                        // (unless it has an OTRS tag, in which case we shouldn't raise the resolution,
                                        // or is Flickr reviewed, in which case only a lower-resolution version may
                                        // be released on Flickr)
                                        reviewUnnecessary = true;
                                        success = true;
                                        if (HasOtrsTag(page) || IsFlickrReviewed(page)) continue;
                                    }

                                    if (!page.title.ToLower().EndsWith(".jpg") && !page.title.ToLower().EndsWith(".png") && !page.title.ToLower().EndsWith(".tiff"))
                                    {
                                        failureReason = "can only review image files, not other file types";
                                        continue;
                                    }

                                    if (!FetchPicasaImageInfo(page, out licenseName, out mediaUrl))
                                    {
                                        failureReason = "could not retrieve image information from Picasa";
                                        continue;
                                    }

                                    if (!reviewUnnecessary && !CheckLicense(page, licenseName))
                                    {
                                        failureReason = "image license on Picasa is invalid";
                                        continue;
                                    }
                                    string licenseChangedFrom = null, licenseChangedTo = null;
                                    if (!reviewUnnecessary && !UpdateLicense(page, licenseName, out licenseChangedFrom, out licenseChangedTo))
                                    {
                                        failureReason = "could not recognize license on Commons page";
                                        continue;
                                    }

                                    string mediaUrlFull = new Regex("^(.*)/([^/]*)$").Replace(mediaUrl, "${1}/d/${2}");
                                    if (!WgetToFile(mediaUrlFull, "temp_picasa_image_full"))
                                    {
                                        failureReason = "license matches and is valid - but could not retrieve full size image from Picasa";
                                        continue;
                                    }

                                    page.DownloadImage("temp_wiki_image");
                                    if (!FilesAreIdentical("temp_picasa_image_full", "temp_wiki_image"))
                                    {
                                        // Upload original full res version
                                        if (!UploadOriginalVersion(out failureReason, page, mediaUrl, "temp_wiki_image", "temp_picasa_image_full", /*fetchThumbnailVersion*/true, /*allowWikiBigger*/false))
                                        {
                                            continue;
                                        }
                                    }

                                    if (!reviewUnnecessary)
                                    {
                                        // It matches! Good to go.
                                        UpdateReviewTagSuccess(page, licenseChangedFrom, licenseChangedTo);
                                        success = true;
                                    }
                                } while (false);

                                if (!success)
                                {
                                    UpdateReviewTagFailure(page, failureReason);
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine("Encountered exception: " + e.Message);
                                Console.WriteLine("Retrying...");
                                continue;
                            }

                            break;
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Encountered exception: " + e.Message);
                }
                Console.WriteLine("Total pages processed: " + totalPagesProcessed);
                Console.WriteLine("Sleeping for 2 minutes...");
                Thread.Sleep(new TimeSpan(0, 2, 0));
            }
        }
Пример #22
0
 /// <summary>This constructor creates PageList object with specified Site object and fills
 /// it with Page objects with specified titles. When constructed, new Page objects
 /// in PageList don't contain text. Use Load() method to get text from live wiki,
 /// or use LoadEx() to get both text and metadata via XML export interface.</summary>
 /// <param name="site">Site object, it must be constructed beforehand.</param>
 /// <param name="pageNames">Page titles as StringCollection object.</param>
 /// <returns>Returns the PageList object.</returns>
 public PageList(Site site, StringCollection pageNames)
 {
     this.site = site;
     foreach (string pageName in pageNames)
         pages.Add(new Page(site, pageName));
     CorrectNSPrefixes();
 }
 public User(Site site, string _name)
 {
     this.name = _name;
     this.site = site;
 }
Пример #24
0
 /// <summary>This constructor creates empty PageList object, Site object with default
 /// properties is created internally and logged in. Constructing new Site object
 /// is too slow, don't use this constructor needlessly.</summary>
 /// <returns>Returns the PageList object.</returns>
 public PageList()
 {
     site = new Site();
 }
 /// <returns>Returns the PageList object.</returns>
 public PageList(Site site, string[] pageNames)
 {
     this.site = site;
     foreach (string pageName in pageNames)
         pages.Add(new Page(site, pageName));
 }
Пример #26
0
 /// <summary>This constructor creates empty Page object with specified Site object,
 /// but without title. Avoid using this constructor needlessly.</summary>
 /// <param name="site">Site object, it must be constructed beforehand.</param>
 /// <returns>Returns Page object.</returns>
 public Page(Site site)
 {
     this.site = site;
 }
Пример #27
0
        public Site LogIn()
        {
            const string siteName = "https://wikidata.org";

            int it = 0;
            while (it < MaxItNum)
            {
                try
                {
                    _wikidataSite = new Site(siteName, Settings.Default.Login, Settings.Default.Password);
                    _commonlog.LogData("Logged to Wikidata", 2);
                    return _wikidataSite;
                }
                catch (Exception e)
                {
                    _commonlog.LogData(e.ToString(), 2);
                    it++;
                    Thread.Sleep(10000 * (int)Math.Pow(2, it));
                }
            }
            _commonlog.LogData("Cannot login", 2);
            throw new ApplicationException("Cannot log in");
        }
Пример #28
0
 /// <summary>This constructor creates Page object with specified page's numeric revision ID
 /// (also called "oldid"). Page title is retrieved automatically in this constructor.
 /// Site object with default properties is created internally and logged in. Constructing
 /// new Site object is too slow, don't use this constructor needlessly.</summary>
 /// <param name="revisionID">Page's numeric revision ID (also called "oldid").</param>
 /// <returns>Returns Page object.</returns>
 public Page(Int64 revisionID)
 {
     if (revisionID <= 0)
         throw new ArgumentOutOfRangeException("revisionID",
             Bot.Msg("Revision ID must be positive."));
     this.site = new Site();
     lastRevisionID = revisionID.ToString();
     GetTitle();
 }
Пример #29
0
        public static void InitWiki()
        {
            WikiSite = new Wiki.Site("http://roleplay-heroes-and-villains.wikia.com", "", "");

            Action <string, Wiki.Page> Personality = (string message, Wiki.Page page) =>
            {
                if (message != "-")
                {
                    page.text += Environment.NewLine + "== Personality ==" + Environment.NewLine + message;
                }
            };

            WikiFields.Add(new List <string> {
                "Personality", "Please enter personality text. To send over 2000 characters, add a `¬` at the end of each message that *isn't* the final message.\nSend `-` if the field should be omitted."
            }, Personality);

            Action <string, Wiki.Page> Backstory = (string message, Wiki.Page page) =>
            {
                if (message != "-")
                {
                    page.text += Environment.NewLine + "== Backstory ==" + Environment.NewLine + message;
                }
            };

            WikiFields.Add(new List <string> {
                "Backstory", "Please enter backstory text. To send over 2000 characters, add a `¬` at the end of each message that *isn't* the final message.\nSend `-` if the field should be omitted."
            }, Backstory);

            Action <string, Wiki.Page> Resources = (string message, Wiki.Page page) =>
            {
                if (message != "-")
                {
                    page.text += Environment.NewLine + "== Resources ==" + Environment.NewLine + message;
                }
            };

            WikiFields.Add(new List <string> {
                "Resources", "Please enter resources text. To send over 2000 characters, add a `¬` at the end of each message that *isn't* the final message.\nSend `-` if the field should be omitted."
            }, Resources);

            Action <string, Wiki.Page> Equipment = (string message, Wiki.Page page) =>
            {
                if (message != "-")
                {
                    page.text += Environment.NewLine + "=== Equipment/Weaponry ===" + Environment.NewLine + message;
                }
            };

            WikiFields.Add(new List <string> {
                "Equipment", "Please enter Equipment text. To send over 2000 characters, add a `¬` at the end of each message that *isn't* the final message.\nSend `-` if the field should be omitted."
            }, Equipment);

            Action <string, Wiki.Page> Specialisations = (string message, Wiki.Page page) =>
            {
                if (message != "-")
                {
                    page.text += Environment.NewLine + "=== Specializations ===" + Environment.NewLine + message;
                }
            };

            WikiFields.Add(new List <string> {
                "Specialisations", "Please enter Specialisations text. To send over 2000 characters, add a `¬` at the end of each message that *isn't* the final message.\nSend `-` if the field should be omitted."
            }, Specialisations);

            Action <string, Wiki.Page> Quirk = (string message, Wiki.Page page) =>
            {
                if (message != "-")
                {
                    page.text += Environment.NewLine + "== Quirk ==" + Environment.NewLine + message;
                }
            };

            WikiFields.Add(new List <string> {
                "Quirk", "Please enter Quirk text. To send over 2000 characters, add a `¬` at the end of each message that *isn't* the final message.\nSend `-` if the field should be omitted."
            }, Quirk);

            Action <string, Wiki.Page> Versatility = (string message, Wiki.Page page) =>
            {
                if (message != "-")
                {
                    page.text += Environment.NewLine + "=== Versatility ===" + Environment.NewLine + message;
                }
            };

            WikiFields.Add(new List <string> {
                "Versatility", "Please enter Quirk Versatility text. To send over 2000 characters, add a `¬` at the end of each message that *isn't* the final message.\nSend `-` if the field should be omitted."
            }, Versatility);

            Action <string, Wiki.Page> Example = (string message, Wiki.Page page) =>
            {
                if (message != "-")
                {
                    page.text += Environment.NewLine + "=== Example ===" + Environment.NewLine + message;
                }
            };

            WikiFields.Add(new List <string> {
                "Example", "Please enter Quirk Example text. To send over 2000 characters, add a `¬` at the end of each message that *isn't* the final message.\nSend `-` if the field should be omitted."
            }, Example);
        }
Пример #30
0
 public MuenzenJob(Site site)
     : base(site)
 {
 }
Пример #31
0
 public BiblioBot()
 {
     Site = new Site("www.bibliopedia.org/smw", "Biblioadmin", "biblio$Wiki0");
 }