Skip to content

Commit

Permalink
Returned local version on error, most likely can't reach github
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Cherry committed Dec 26, 2023
1 parent 5bb9d3f commit f41a5a8
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions Utility/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,22 @@ public static string ServerClientVersion
{
get
{
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json"));
client.DefaultRequestHeaders.Add("User-Agent", "Genie Client Updater");
try
{
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json"));
client.DefaultRequestHeaders.Add("User-Agent", "Genie Client Updater");

var streamTask = client.GetStreamAsync(GitHubClientReleaseURL).Result;
Release latest = JsonSerializer.Deserialize<Release>(streamTask);
var streamTask = client.GetStreamAsync(GitHubClientReleaseURL).Result;
Release latest = JsonSerializer.Deserialize<Release>(streamTask);

return latest.Version;
return latest.Version;
}
catch
{
//if we can't reach github just report current because we can't update
return LocalClientVersion;
}
}
}

Expand Down

0 comments on commit f41a5a8

Please sign in to comment.