OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Functions / AppcastReader.cs
index 9442585..861bd0b 100644 (file)
@@ -7,6 +7,7 @@
 using System;\r
 using System.Xml;\r
 using System.Text.RegularExpressions;\r
+using System.IO;\r
 \r
 namespace Handbrake.Functions\r
 {\r
@@ -15,15 +16,15 @@ namespace Handbrake.Functions
         /// <summary>\r
         /// Get the build information from the required appcasts. Run before accessing the public vars.\r
         /// </summary>\r
-        public void getInfo()\r
+        public void getInfo(string input)\r
         {\r
             // Get the correct Appcast and set input.\r
-            XmlNode nodeItem = Properties.Settings.Default.hb_build.ToString().EndsWith("1") ? readRss(new XmlTextReader(Properties.Settings.Default.appcast_unstable)) : readRss(new XmlTextReader(Properties.Settings.Default.appcast));\r
-            string input = nodeItem.InnerXml;\r
+            XmlNode nodeItem = readRss(new XmlTextReader(new StringReader(input)));\r
+            string result = nodeItem.InnerXml;\r
 \r
             // Regular Expressions\r
-            Match ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\""");\r
-            Match verShort = Regex.Match(input, @"sparkle:shortVersionString=""([0-9].[0-9].[0-9]*)\""");\r
+            Match ver = Regex.Match(result, @"sparkle:version=""([0-9]*)\""");\r
+            Match verShort = Regex.Match(result, @"sparkle:shortVersionString=""([0-9].[0-9].[0-9]*)\""");\r
 \r
             build = ver.ToString().Replace("sparkle:version=", "").Replace("\"", "");\r
             version = verShort.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", "");\r