diff --git a/FreeMove/Properties/AssemblyInfo.cs b/FreeMove/Properties/AssemblyInfo.cs
index b4f07b8..36952b8 100644
--- a/FreeMove/Properties/AssemblyInfo.cs
+++ b/FreeMove/Properties/AssemblyInfo.cs
@@ -32,5 +32,6 @@
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
// usando l'asterisco '*' come illustrato di seguito:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.0")]
-[assembly: AssemblyFileVersion("1.2.0.0")]
+
+[assembly: AssemblyVersion("1.2.2")]
+[assembly: AssemblyFileVersion("1.2.2")]
\ No newline at end of file
diff --git a/FreeMove/Properties/Resources.Designer.cs b/FreeMove/Properties/Resources.Designer.cs
index 72ae200..9b64f4b 100644
--- a/FreeMove/Properties/Resources.Designer.cs
+++ b/FreeMove/Properties/Resources.Designer.cs
@@ -61,7 +61,8 @@ internal Resources() {
}
///
- /// Cerca una stringa localizzata simile a Could not retrieve the version information from the GitHub server.
+ /// Cerca una stringa localizzata simile a Could not retrieve the version information
+ ///from the GitHub server.
///
internal static string GitHubErrorMessage {
get {
diff --git a/FreeMove/Properties/Resources.resx b/FreeMove/Properties/Resources.resx
index 2c6335c..29ba8b3 100644
--- a/FreeMove/Properties/Resources.resx
+++ b/FreeMove/Properties/Resources.resx
@@ -118,6 +118,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- Could not retrieve the version information from the GitHub server
+ Could not retrieve the version information
+from the GitHub server
\ No newline at end of file
diff --git a/FreeMove/Updater.Designer.cs b/FreeMove/Updater.Designer.cs
index 544500c..0d9e08a 100644
--- a/FreeMove/Updater.Designer.cs
+++ b/FreeMove/Updater.Designer.cs
@@ -52,7 +52,6 @@ private void InitializeComponent()
this.button_Ok.TabIndex = 1;
this.button_Ok.Text = "Ok";
this.button_Ok.UseVisualStyleBackColor = true;
- this.button_Ok.Click += new System.EventHandler(this.Button1_Click);
//
// button_Cancel
//
@@ -63,7 +62,6 @@ private void InitializeComponent()
this.button_Cancel.TabIndex = 1;
this.button_Cancel.Text = "Cancel";
this.button_Cancel.UseVisualStyleBackColor = true;
- this.button_Cancel.Click += new System.EventHandler(this.Button2_Click);
//
// progressBar1
//
diff --git a/FreeMove/Updater.cs b/FreeMove/Updater.cs
index f6fbf6a..1669cb5 100644
--- a/FreeMove/Updater.cs
+++ b/FreeMove/Updater.cs
@@ -12,6 +12,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Reflection;
+using System.Text.RegularExpressions;
namespace FreeMove
{
@@ -48,9 +49,10 @@ private async void Updater_Load(object sender, EventArgs e)
}
catch(Exception ex)
{
- if (ex.Message == Properties.Resources.GitHubErrorMessage)
+ if (ex.Message == Properties.Resources.GitHubErrorMessage || ex is WebException)
{
label1.Text = Properties.Resources.GitHubErrorMessage;
+ progressBar1.Dispose();
button_Ok.Enabled = true;
button_Ok.Click += delegate { Dispose(); };
}
@@ -64,30 +66,15 @@ public async Task CheckForUpdate()
Req.UserAgent = "ImDema/FreeMove Updater";
HttpWebResponse Response = (HttpWebResponse) await Req.GetResponseAsync();
Stream ResponseStream = Response.GetResponseStream();
- JsonTextReader Reader = new JsonTextReader(new StreamReader(ResponseStream));
- while(await Reader.ReadAsync())
- {
- if(Reader.TokenType == JsonToken.PropertyName && (string)Reader.Value == "tag_name")
- {
- Reader.Read();
- NewVersion = Reader.Value as string + ".0";
- break;
- }
- }
+
+ TextReader Reader = new StreamReader(ResponseStream);
+ const string pattern = "\"tag_name\":\"([0-9.]{5,9})\"";
+ NewVersion = Regex.Match(Reader.ReadToEnd(), pattern,RegexOptions.Multiline).Groups[1].Value;
+
if (NewVersion == "") throw new Exception(Properties.Resources.GitHubErrorMessage);
Assembly assembly = Assembly.GetExecutingAssembly();
CurrentVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location).FileVersion;
return CurrentVersion != NewVersion;
}
-
- private void Button2_Click(object sender, EventArgs e)
- {
-
- }
-
- private void Button1_Click(object sender, EventArgs e)
- {
-
- }
}
}