summaryrefslogtreecommitdiffstats
path: root/win/C#/Functions
diff options
context:
space:
mode:
authorsr55 <[email protected]>2007-11-19 19:21:53 +0000
committersr55 <[email protected]>2007-11-19 19:21:53 +0000
commitb8778cc395681bf40e9f9a5fdcada956f174072d (patch)
treeda95afb46233e805c7af78729156f0de96ef3168 /win/C#/Functions
parentca6b1dbdf7a7249f8d9ea00cdfe4681a05ade2fa (diff)
WinGui:
- About window text cut down. Had some useless information. - New "sparkle"-like update manager. - Misc Other small updates and fixes. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1070 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions')
-rw-r--r--win/C#/Functions/RssReader.cs146
1 files changed, 146 insertions, 0 deletions
diff --git a/win/C#/Functions/RssReader.cs b/win/C#/Functions/RssReader.cs
new file mode 100644
index 000000000..d564eeeb5
--- /dev/null
+++ b/win/C#/Functions/RssReader.cs
@@ -0,0 +1,146 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using System.IO;
+using System.Xml;
+using System.Text.RegularExpressions;
+
+namespace Handbrake.Functions
+{
+ class RssReader
+ {
+ XmlTextReader rssReader;
+ XmlDocument rssDoc;
+ XmlNode nodeRss;
+ XmlNode nodeChannel;
+ XmlNode nodeItem;
+ string t;
+
+ private string readRss()
+ {
+ rssReader = new XmlTextReader("http://download.m0k.org/handbrake/appcast.xml");
+ rssDoc = new XmlDocument();
+ rssDoc.Load(rssReader);
+
+ for (int i = 0; i < rssDoc.ChildNodes.Count; i++)
+ {
+ if (rssDoc.ChildNodes[i].Name == "rss")
+ {
+ nodeRss = rssDoc.ChildNodes[i];
+ }
+ }
+
+ for (int i = 0; i < nodeRss.ChildNodes.Count; i++)
+ {
+ if (nodeRss.ChildNodes[i].Name == "channel")
+ {
+ nodeChannel = nodeRss.ChildNodes[i];
+ }
+ }
+
+ string latestTitle = "";
+ for (int i = 0; i < nodeChannel.ChildNodes.Count; i++)
+ {
+
+ if (nodeChannel.ChildNodes[i].Name == "item")
+ {
+ nodeItem = nodeChannel.ChildNodes[i];
+ latestTitle = nodeItem["title"].InnerText;
+ }
+ }
+ return latestTitle;
+ }
+
+
+ public string versionInfo()
+ {
+ readRss();
+ string vinfo = "";
+ for (int i = 0; i < nodeChannel.ChildNodes.Count; i++)
+ {
+ if (nodeChannel.ChildNodes[6].Name == "item")
+ {
+ nodeItem = nodeChannel.ChildNodes[0];
+ t = readRss();
+ if (nodeItem["title"].InnerText == t)
+ {
+ vinfo = nodeItem["description"].InnerText;
+ break;
+ }
+ }
+ }
+
+ return vinfo;
+ }
+
+ public string version()
+ {
+ readRss();
+ string vinfo = "";
+ for (int i = 0; i < nodeChannel.ChildNodes.Count; i++)
+ {
+ if (nodeChannel.ChildNodes[6].Name == "item")
+ {
+ nodeItem = nodeChannel.ChildNodes[0];
+ string t = readRss();
+ if (nodeItem["title"].InnerText == t)
+ {
+ string input = nodeItem.InnerXml;
+ Match ver = Regex.Match(input, @"sparkle:shortVersionString=""([0-9].[0-9].[0-9]*)\""");
+ vinfo = ver.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", "");
+
+ break;
+ }
+ }
+ }
+ return vinfo;
+ }
+
+ public string build()
+ {
+ readRss();
+ string vinfo = "";
+ for (int i = 0; i < nodeChannel.ChildNodes.Count; i++)
+ {
+ if (nodeChannel.ChildNodes[6].Name == "item")
+ {
+ nodeItem = nodeChannel.ChildNodes[0];
+ string t = readRss();
+ if (nodeItem["title"].InnerText == t)
+ {
+ string input = nodeItem.InnerXml;
+ Match ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\""");
+ vinfo = ver.ToString().Replace("sparkle:version=", "").Replace("\"", "");
+ break;
+ }
+ }
+ }
+ return vinfo;
+ }
+
+ public string downloadFile()
+ {
+ readRss();
+ string file = "";
+ for (int i = 0; i < nodeChannel.ChildNodes.Count; i++)
+ {
+ if (nodeChannel.ChildNodes[6].Name == "item")
+ {
+ nodeItem = nodeChannel.ChildNodes[0];
+ t = readRss();
+ if (nodeItem["title"].InnerText == t)
+ {
+ file = nodeItem["windows"].InnerText;
+ break;
+ }
+ }
+ }
+
+ return file;
+ }
+ }
+} \ No newline at end of file