コード例 #1
0
ファイル: Page.cs プロジェクト: Benestar/DotNetDataBot
 /// <summary>Undoes the last edit, so page text reverts to previous contents.
 /// The function doesn't affect other actions 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);
     Console.WriteLine(Bot.Msg("Page \"{0}\" was reverted."), title);
 }