3 This file is part of the HandBrake source code.
\r
4 Homepage: <http://handbrake.m0k.org/>.
\r
5 It may be used under the terms of the GNU General Public License. */
\r
8 using System.Collections.Generic;
\r
9 using System.ComponentModel;
\r
11 using System.Drawing;
\r
13 using System.Windows.Forms;
\r
16 using System.Text.RegularExpressions;
\r
18 namespace Handbrake.Functions
\r
22 XmlTextReader rssReader;
\r
25 XmlNode nodeChannel;
\r
29 private string readRss()
\r
31 rssReader = new XmlTextReader("http://handbrake.m0k.org/appcast.xml");
\r
32 rssDoc = new XmlDocument();
\r
33 rssDoc.Load(rssReader);
\r
35 for (int i = 0; i < rssDoc.ChildNodes.Count; i++)
\r
37 if (rssDoc.ChildNodes[i].Name == "rss")
\r
39 nodeRss = rssDoc.ChildNodes[i];
\r
43 for (int i = 0; i < nodeRss.ChildNodes.Count; i++)
\r
45 if (nodeRss.ChildNodes[i].Name == "channel")
\r
47 nodeChannel = nodeRss.ChildNodes[i];
\r
51 string latestTitle = "";
\r
52 for (int i = 0; i < nodeChannel.ChildNodes.Count; i++)
\r
55 if (nodeChannel.ChildNodes[i].Name == "item")
\r
57 nodeItem = nodeChannel.ChildNodes[i];
\r
58 latestTitle = nodeItem["title"].InnerText;
\r
64 private string hb_versionInfo;
\r
65 private string hb_version;
\r
66 private string hb_build;
\r
67 private string hb_file;
\r
69 public void getInfo()
\r
72 for (int i = 0; i < nodeChannel.ChildNodes.Count; i++)
\r
74 if (nodeChannel.ChildNodes[6].Name == "item")
\r
76 nodeItem = nodeChannel.ChildNodes[0];
\r
78 if (nodeItem["title"].InnerText == t)
\r
80 // Get the Version Information
\r
81 hb_versionInfo = nodeItem["description"].InnerText;
\r
84 string input = nodeItem.InnerXml;
\r
85 Match ver = Regex.Match(input, @"sparkle:shortVersionString=""([0-9].[0-9].[0-9]*)\""");
\r
86 hb_version = ver.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", "");
\r
88 // Get the build number
\r
89 input = nodeItem.InnerXml;
\r
90 ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\""");
\r
91 hb_build = ver.ToString().Replace("sparkle:version=", "").Replace("\"", "");
\r
93 // Get the update file
\r
94 hb_file = nodeItem["windows"].InnerText;
\r
101 public string versionInfo()
\r
104 return hb_versionInfo;
\r
107 public string version()
\r
113 public string build()
\r
119 public string downloadFile()
\r