Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ning committed Oct 6, 2021
1 parent 8fa5979 commit 9bf3087
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions WpfApp1/Helper/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,29 +89,33 @@ public static string RunApp(string filename, string arguments, bool recordLog)

public static bool CheckUpdate()
{
var client = new HttpClient();
using (var request = new HttpRequestMessage(HttpMethod.Get, "https://raw.githubusercontent.com/ningjx/F1-2020-Telemetering-Tools/master/WpfApp1/Properties/AssemblyInfo.cs"))
try
{
var response = client.SendAsync(request).Result;

if (response.IsSuccessStatusCode)
var client = new HttpClient();
using (var request = new HttpRequestMessage(HttpMethod.Get, "https://raw.githubusercontent.com/ningjx/F1-2020-Telemetering-Tools/master/WpfApp1/Properties/AssemblyInfo.cs"))
{
var dataString = response.Content.ReadAsStringAsync().Result;
if (!string.IsNullOrEmpty(dataString))
var response = client.SendAsync(request).Result;

if (response.IsSuccessStatusCode)
{
var re = new Regex(@"(?<=AssemblyVersion\("")\d\.\d\.\d\.\d(?<!\""\))");
var version = re.Match(dataString).Value;
if (!string.IsNullOrEmpty(version))
var dataString = response.Content.ReadAsStringAsync().Result;
if (!string.IsNullOrEmpty(dataString))
{
var items = version.Split('.');
var curVer = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var newVer = new Version(Convert.ToInt32(items[0]), Convert.ToInt32(items[1]), Convert.ToInt32(items[2]), Convert.ToInt32(items[3]));
return newVer > curVer;
var re = new Regex(@"(?<=AssemblyVersion\("")\d\.\d\.\d\.\d(?<!\""\))");
var version = re.Match(dataString).Value;
if (!string.IsNullOrEmpty(version))
{
var items = version.Split('.');
var curVer = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var newVer = new Version(Convert.ToInt32(items[0]), Convert.ToInt32(items[1]), Convert.ToInt32(items[2]), Convert.ToInt32(items[3]));
return newVer > curVer;
}
}
}
return false;
}
return false;
}
catch { return false; }
}
}
}

0 comments on commit 9bf3087

Please sign in to comment.