Skip to content

Commit

Permalink
Updates fix
Browse files Browse the repository at this point in the history
  • Loading branch information
seerge committed Apr 14, 2024
1 parent 04143ab commit f983bda
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/Updates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,13 @@ public async void DriversAsync(string url, string model, int type, TableLayoutPa
var json = await httpClient.GetStringAsync(urlNormal);

var data = JsonSerializer.Deserialize<JsonElement>(json);
var result = data.GetProperty("Result");

// fallback for bugged API
if (data.GetProperty("Result").ToString() == "")
if (result.ToString() == "" || result.GetProperty("Obj").GetArrayLength() == 0)
{
Random rnd = new Random();
var urlFallback = url.Replace("CPUNAME", model + rnd.Next(100, 999));
var urlFallback = url.Replace("CPUNAME", model + rnd.Next(10, 99));
Logger.WriteLine(urlFallback);
json = await httpClient.GetStringAsync(urlFallback);
data = JsonSerializer.Deserialize<JsonElement>(json);
Expand Down

0 comments on commit f983bda

Please sign in to comment.