コード例 #1
0
        /// <summary>Fetches the History of the current Page</summary>
        /// <param name="reason">nothing</param>	
        public History GetHistory()
        {
            //System.Web.HttpUtility httputil = new System.Web.HttpUtility();

            string url="http://de.wikipedia.org/w/query.php?what=revisions&rvlimit=100&format=xml&titles=" +  System.Web.HttpUtility.UrlEncode(title);
            Uri pageHistory = new Uri(url);
            //Console.WriteLine(url);
            Bot.InitWebClient();
            string respStr = Bot.wc.DownloadString(pageHistory);

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(respStr);

            XmlNodeList list = doc.GetElementsByTagName("rv");
            ArrayList history = new ArrayList();
            for (int i=0; i<list.Count;i++){
                User user = new User(this.site,	list.Item(i).Attributes.GetNamedItem("user").InnerText);
                string revision = list.Item(i).Attributes.GetNamedItem("revid").InnerText;
                string oldid = list.Item(i).Attributes.GetNamedItem("oldid").InnerText;
                string timestamp = list.Item(i).Attributes.GetNamedItem("timestamp").InnerText;
                history.Add(new HistoryEntry(user, revision, oldid, timestamp));
            }
            //Console.Write(respStr);
            return new History(history);
        }
コード例 #2
0
 public HistoryEntry(User user, string revision, string oldid, string timestamp)
 {
     this.user = user;
     this.revision = revision;
     this.oldid = oldid;
     this.timestamp = timestamp;
 }