Skip to content

Commit

Permalink
simplify code in VLC.searchForNewer() method
Browse files Browse the repository at this point in the history
  • Loading branch information
striezel committed Oct 5, 2024
1 parent 7856600 commit a251f1b
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions updater/software/VLC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,22 +243,18 @@ public override AvailableSoftware searchForNewer()
// The get.videolan.org/vlc/... URL redirects randomly to a VLC mirror server.
// Some of those servers might not have a valid TLS certificate, so we try
// some other mirror.
using (var mirrorClient = new HttpClient())
try
{
try
{
logger.Info("Trying another VLC mirror instead...");
string full_version = newVersion.full();
var task = mirrorClient.GetStringAsync("https://ftp.halifax.rwth-aachen.de/videolan/vlc/" + full_version + "/win" + bits + "/vlc-" + full_version + "-win" + bits + ".exe.sha256");
task.Wait();
htmlCode = task.Result;
}
catch (Exception ex)
{
logger.Warn("Exception occurred while checking for newer version of VLC on a mirror: " + ex.Message);
return null;
}
mirrorClient.Dispose();
logger.Info("Trying another VLC mirror instead...");
string full_version = newVersion.full();
var task = client.GetStringAsync("https://ftp.halifax.rwth-aachen.de/videolan/vlc/" + full_version + "/win" + bits + "/vlc-" + full_version + "-win" + bits + ".exe.sha256");
task.Wait();
htmlCode = task.Result;
}
catch (Exception ex)
{
logger.Warn("Exception occurred while checking for newer version of VLC on a mirror: " + ex.Message);
return null;
}
}
client.Dispose();
Expand Down

0 comments on commit a251f1b

Please sign in to comment.