fix: autoupdater failing to fetch prerelease versions
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -91,14 +92,19 @@ namespace CarManagerV3.Manager
|
||||
{
|
||||
using (var client = new System.Net.Http.HttpClient())
|
||||
{
|
||||
UrlEncoder encoder = System.Text.Encodings.Web.UrlEncoder.Default;
|
||||
var response = client.GetAsync(PreReleaseEndpoint).Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
|
||||
var content = response.Content.ReadAsStringAsync().Result;
|
||||
dynamic releases = Newtonsoft.Json.JsonConvert.DeserializeObject(content);
|
||||
//System.Diagnostics.Debug.WriteLine("Fetched pre-release versions, count: " + releases.Count);
|
||||
if (releases.Count > 0)
|
||||
{
|
||||
var preReleaseVersion = releases[0].tag_name;
|
||||
var preReleaseVersion = releases[0].tag_name.ToString();
|
||||
//System.Diagnostics.Debug.WriteLine("Latest unstable version: " + preReleaseVersion);
|
||||
|
||||
// Compare versions and return the newer one
|
||||
if (IsNewerVersion(preReleaseVersion, latestVersion))
|
||||
{
|
||||
@@ -107,6 +113,10 @@ namespace CarManagerV3.Manager
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Failed to fetch pre-release versions, status code: " + response.StatusCode + " at: " + PreReleaseEndpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
SetCache(latestVersion, includePreRelease);
|
||||
|
||||
Reference in New Issue
Block a user