diff options
author | sr55 <[email protected]> | 2010-09-19 12:17:07 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2010-09-19 12:17:07 +0000 |
commit | 1d3a178d671af6d09b3e3be35562fe5070ace809 (patch) | |
tree | 288f38ac3e39cf5300fb7d3ddffff5e3604b1565 /win/C#/Functions/AppcastReader.cs | |
parent | 8cac9d8c62ce452ff27a6b70f005056f44b55581 (diff) |
WinGui:
- Moved some non-specific HandBrake code (Exception Window, Update Information Window, Update Download Window) out into a separate framework library. Hoping to make this more reusable at a later point.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3543 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions/AppcastReader.cs')
-rw-r--r-- | win/C#/Functions/AppcastReader.cs | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/win/C#/Functions/AppcastReader.cs b/win/C#/Functions/AppcastReader.cs deleted file mode 100644 index 6b4a48470..000000000 --- a/win/C#/Functions/AppcastReader.cs +++ /dev/null @@ -1,119 +0,0 @@ -/* RssReader.cs $
- This file is part of the HandBrake source code.
- Homepage: <http://handbrake.fr>.
- It may be used under the terms of the GNU General Public License. */
-
-namespace Handbrake.Functions
-{
- using System;
- using System.IO;
- using System.Text.RegularExpressions;
- using System.Xml;
-
- /// <summary>
- /// Appcast Reader - Used for parsing HandBrakes update file
- /// </summary>
- public class AppcastReader
- {
- /// <summary>
- /// Gets Information about an update to HandBrake
- /// </summary>
- public Uri DescriptionUrl { get; private set; }
-
- /// <summary>
- /// Gets HandBrake's version from the appcast.xml file.
- /// </summary>
- public string Version { get; private set; }
-
- /// <summary>
- /// Gets HandBrake's Build from the appcast.xml file.
- /// </summary>
- public string Build { get; private set; }
-
- /// <summary>
- /// Gets the URL for update file.
- /// </summary>
- public string DownloadFile { get; private set; }
-
- /// <summary>
- /// Get the build information from the required appcasts. Run before accessing the public vars.
- /// </summary>
- /// <param name="input">
- /// The input.
- /// </param>
- public void GetInfo(string input)
- {
- try
- {
- // Get the correct Appcast and set input.
- XmlNode nodeItem = ReadRss(new XmlTextReader(new StringReader(input)));
- string result = nodeItem.InnerXml;
-
- // Regular Expressions
- Match ver = Regex.Match(result, @"sparkle:version=""([0-9]*)\""");
- Match verShort = Regex.Match(result, @"sparkle:shortVersionString=""(([svn]*)([0-9.\s]*))\""");
-
- this.Build = ver.ToString().Replace("sparkle:version=", string.Empty).Replace("\"", string.Empty);
- this.Version = verShort.ToString().Replace("sparkle:shortVersionString=", string.Empty).Replace(
- "\"", string.Empty);
- this.DownloadFile = nodeItem["windows"].InnerText;
- this.DescriptionUrl = new Uri(nodeItem["sparkle:releaseNotesLink"].InnerText);
- }
- catch (Exception)
- {
- return;
- }
- }
-
- /// <summary>
- /// Read the RSS file.
- /// </summary>
- /// <param name="rssReader">
- /// The RSS reader
- /// </param>
- /// <returns>
- /// The read rss.
- /// </returns>
- private static XmlNode ReadRss(XmlReader rssReader)
- {
- XmlNode nodeItem = null;
- XmlNode nodeChannel = null;
- XmlNode nodeRss = null;
-
- XmlDocument rssDoc = new XmlDocument();
- rssDoc.Load(rssReader);
-
- foreach (XmlNode t in rssDoc.ChildNodes)
- {
- if (t.Name == "rss")
- {
- nodeRss = t;
- }
- }
-
- if (nodeRss != null)
- {
- foreach (XmlNode t in nodeRss.ChildNodes)
- {
- if (t.Name == "channel")
- {
- nodeChannel = t;
- }
- }
- }
-
- if (nodeChannel != null)
- {
- foreach (XmlNode t in nodeChannel.ChildNodes)
- {
- if (t.Name == "item")
- {
- nodeItem = t;
- }
- }
- }
-
- return nodeItem;
- }
- }
-}
\ No newline at end of file |