/// <summary>Undoes all last edits of last page contributor, so page text reverts to
 ///  previous contents. The function doesn't affect other operations
 /// like renaming or protecting.</summary>
 /// <param name="comment">Revert comment.</param>
 /// <param name="isMinorEdit">Minor edit mark (pass true for minor edit).</param>
 public void UndoLastEdits(string comment, bool isMinorEdit)
 {
     if (string.IsNullOrEmpty(title))
         throw new WikiBotException(Bot.Msg("No title specified for page to revert."));
     PageList pl = new PageList(site);
     string lastEditor = "";
     for (int i = 50; i <= 5000; i *= 10) {
         if (Bot.useBotQuery == true && site.botQuery == true &&
             site.botQueryVersions.ContainsKey("ApiQueryRevisions.php"))
                 pl.FillFromPageHistoryEx(title, i, false);
         else
             pl.FillFromPageHistory(title, i);
         lastEditor = pl[0].lastUser;
         foreach (Page p in pl)
             if (p.lastUser != lastEditor) {
                 p.Load();
                 Save(p.text, comment, isMinorEdit);
                 Bot.LogEvent(
                     Bot.Msg("Last edits of page \"{0}\" by user {1} were undone."),
                     title, lastEditor);
                 return;
             }
         pl.Clear();
     }
     Console.Error.WriteLine(Bot.Msg("Can't undo last edits of page \"{0}\" by user {1}."),
         title, lastEditor);
 }
 /// <summary>Undoes the last edit, so page text reverts to previous contents.
 /// The function doesn't affect other operations like renaming.</summary>
 /// <param name="comment">Revert comment.</param>
 /// <param name="isMinorEdit">Minor edit mark (pass true for minor edit).</param>
 public void Revert(string comment, bool isMinorEdit)
 {
     if (string.IsNullOrEmpty(title))
         throw new WikiBotException(Bot.Msg("No title specified for page to revert."));
     PageList pl = new PageList(site);
     if (Bot.useBotQuery == true && site.botQuery == true &&
         site.botQueryVersions.ContainsKey("ApiQueryRevisions.php"))
             pl.FillFromPageHistoryEx(title, 2, false);
     else
         pl.FillFromPageHistory(title, 2);
     if (pl.Count() != 2) {
         Console.Error.WriteLine(Bot.Msg("Can't revert page \"{0}\"."), title);
         return;
     }
     pl[1].Load();
     Save(pl[1].text, comment, isMinorEdit);
     Bot.LogEvent(Bot.Msg("Page \"{0}\" was reverted."), title);
 }