/// <summary>
/// Retrieves the history for an article.
/// </summary>
/// <param name="Article">The article that history is required for.</param>
/// <param name="Limit">The maximum number of revisions to return.</param>
/// <returns>The history, as a generic list of Revision objects.</returns>
public List <Revision> GetHistory(string Article, int Limit)
{
string targetUrl = m_indexpath + "api.php?action=query&prop=revisions&titles=" + HttpUtility.UrlEncode(Article) +
"&rvlimit=" + Limit;
HttpWebRequest wr = Variables.PrepareWebRequest(targetUrl, UserAgent);
List <Revision> history = new List <Revision>();
HttpWebResponse resps = (HttpWebResponse)wr.GetResponse();
Stream stream = resps.GetResponseStream();
StreamReader sr = new StreamReader(stream);
string pagetext = sr.ReadToEnd();
XmlDocument doc = new XmlDocument();
doc.LoadXml(pagetext);
foreach (XmlElement rvElement in doc.GetElementsByTagName("rev"))
{
Revision rv = new Revision();
rv.RevisionID = Convert.ToInt32(rvElement.Attributes["revid"].Value);
rv.Time = DateTime.Parse(rvElement.Attributes["timestamp"].Value);
rv.Summary = rvElement.InnerText;
rv.User = rvElement.Attributes["user"].Value;
rv.Minor = (rvElement.OuterXml.Contains("minor=\""));
history.Add(rv);
}
return(history);
}