diff options
author | sr55 <[email protected]> | 2009-06-17 15:38:29 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2009-06-17 15:38:29 +0000 |
commit | 0c4a88000b2a9456c2079a256c00b0baf43699a7 (patch) | |
tree | 4e263429b5cc2ee63966f36c05fe7241eee70314 /win/C#/Functions | |
parent | 17add0e3258936078d05508709f550a74e5c4146 (diff) |
WinGui:
- Updated the appcast checker to handle the modified appcast format.
- New option to set the number of days between update checks on startup. Default 5
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2551 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/C#/Functions')
-rw-r--r-- | win/C#/Functions/AppcastReader.cs | 54 | ||||
-rw-r--r-- | win/C#/Functions/Main.cs | 3 |
2 files changed, 19 insertions, 38 deletions
diff --git a/win/C#/Functions/AppcastReader.cs b/win/C#/Functions/AppcastReader.cs index b52c22d77..e86259ff7 100644 --- a/win/C#/Functions/AppcastReader.cs +++ b/win/C#/Functions/AppcastReader.cs @@ -4,6 +4,7 @@ Homepage: <http://handbrake.fr>.
It may be used under the terms of the GNU General Public License. */
+using System;
using System.Xml;
using System.Text.RegularExpressions;
@@ -15,7 +16,7 @@ namespace Handbrake.Functions XmlNode nodeRss;
XmlNode nodeChannel;
XmlNode nodeItem;
- private string hb_description;
+ private Uri hb_description;
private string hb_version;
private string hb_build;
private string hb_file;
@@ -26,49 +27,26 @@ namespace Handbrake.Functions /// </summary>
public void getInfo()
{
- int unstable_build = 0;
- string unstable_description = "", unstable_version = "";
- string unstable_file = "";
+ // Get the correct Appcast and set input.
+ if (Properties.Settings.Default.hb_build.ToString().EndsWith("1"))
+ readRss(new XmlTextReader(Properties.Settings.Default.appcast_unstable));
+ else
+ readRss(new XmlTextReader(Properties.Settings.Default.appcast));
- // Check the stable appcast and get the stable build number
- readRss(new XmlTextReader(Properties.Settings.Default.appcast));
string input = nodeItem.InnerXml;
+
+ // Regular Expressions
Match ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\""");
- int stable_build = int.Parse(ver.ToString().Replace("sparkle:version=", "").Replace("\"", ""));
- ver = Regex.Match(input, @"sparkle:shortVersionString=""([0-9].[0-9].[0-9]*)\""");
- string stable_version = ver.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", "");
- string stable_description = nodeItem["description"].InnerText;
- string stable_file = nodeItem["windows"].InnerText;
+ Match verShort = Regex.Match(input, @"sparkle:shortVersionString=""([0-9].[0-9].[0-9]*)\""");
- // If this is a snapshot release, or the user wants to check for snapshot releases
- if (Properties.Settings.Default.checkSnapshot == "Checked" || Properties.Settings.Default.hb_build.ToString().EndsWith("1"))
+ if (nodeItem != null)
{
- // Get the stable build
- readRss(new XmlTextReader(Properties.Settings.Default.appcast_unstable));
- input = nodeItem.InnerXml;
- ver = Regex.Match(input, @"sparkle:version=""([0-9]*)\""");
- unstable_build = int.Parse(ver.ToString().Replace("sparkle:version=", "").Replace("\"", ""));
- ver = Regex.Match(input, @"sparkle:shortVersionString=""([0-9a-zA-Z.]*)\""");
- unstable_version = ver.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", "");
- unstable_description = nodeItem["description"].InnerText;
- unstable_file = nodeItem["windows"].InnerText;
+ hb_build = ver.ToString().Replace("sparkle:version=", "").Replace("\"", "");
+ hb_version = verShort.ToString().Replace("sparkle:shortVersionString=", "").Replace("\"", "");
+ hb_file = nodeItem["windows"].InnerText;
+ hb_description = new Uri(nodeItem["sparkle:releaseNotesLink"].InnerText);
}
- // Set the global version information
- if (stable_build >= unstable_build)
- {
- hb_description = stable_description;
- hb_version = stable_version;
- hb_build = stable_build.ToString();
- hb_file = stable_file;
- }
- else
- {
- hb_description = unstable_description;
- hb_version = unstable_version;
- hb_build = unstable_build.ToString();
- hb_file = unstable_file;
- }
}
/// <summary>
@@ -103,7 +81,7 @@ namespace Handbrake.Functions /// Get Information about an update to HandBrake
/// </summary>
/// <returns></returns>
- public string versionInfo()
+ public System.Uri descriptionUrl()
{
return hb_description;
}
diff --git a/win/C#/Functions/Main.cs b/win/C#/Functions/Main.cs index 9d936cd25..f6c85b1cf 100644 --- a/win/C#/Functions/Main.cs +++ b/win/C#/Functions/Main.cs @@ -208,6 +208,9 @@ namespace Handbrake.Functions if (latest == skip)
return false;
+ Properties.Settings.Default.lastUpdateCheckDate = DateTime.Now;
+ Properties.Settings.Default.Save();
+
Boolean update = (latest > current);
return update;
}
|