mirror of
https://github.com/sp-tarkov/installer.git
synced 2025-02-12 13:50:45 -05:00
add catch / retry to inital release json check
This commit is contained in:
parent
113ff42ed8
commit
aa31c970ba
@ -10,8 +10,8 @@
|
||||
<PackageIcon>icon.ico</PackageIcon>
|
||||
<ApplicationIcon>Assets\spt_installer.ico</ApplicationIcon>
|
||||
<Configurations>Debug;Release;TEST</Configurations>
|
||||
<AssemblyVersion>2.95</AssemblyVersion>
|
||||
<FileVersion>2.95</FileVersion>
|
||||
<AssemblyVersion>2.96</AssemblyVersion>
|
||||
<FileVersion>2.96</FileVersion>
|
||||
<Company>SPT</Company>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -244,29 +244,44 @@ public class PreChecksViewModel : ViewModelBase
|
||||
InstallButtonCheckState = StatusSpinner.SpinnerState.Running;
|
||||
|
||||
var progress = new Progress<double>((d) => { });
|
||||
|
||||
var SPTReleaseInfoFile =
|
||||
await DownloadCacheHelper.GetOrDownloadFileAsync("release.json", DownloadCacheHelper.ReleaseMirrorUrl,
|
||||
progress, DownloadCacheHelper.SuggestedTtl);
|
||||
|
||||
if (SPTReleaseInfoFile == null)
|
||||
|
||||
ReleaseInfo? sptReleaseInfo = null;
|
||||
var retries = 1;
|
||||
|
||||
while (retries >= 0)
|
||||
{
|
||||
InstallButtonText = "Could not get SPT release metadata";
|
||||
InstallButtonCheckState = StatusSpinner.SpinnerState.Error;
|
||||
return;
|
||||
retries--;
|
||||
|
||||
try
|
||||
{
|
||||
var sptReleaseInfoFile =
|
||||
await DownloadCacheHelper.GetOrDownloadFileAsync("release.json", DownloadCacheHelper.ReleaseMirrorUrl,
|
||||
progress, DownloadCacheHelper.SuggestedTtl);
|
||||
|
||||
if (sptReleaseInfoFile == null)
|
||||
{
|
||||
InstallButtonText = "Could not get SPT release metadata";
|
||||
InstallButtonCheckState = StatusSpinner.SpinnerState.Error;
|
||||
return;
|
||||
}
|
||||
|
||||
sptReleaseInfo =
|
||||
JsonConvert.DeserializeObject<ReleaseInfo>(File.ReadAllText(sptReleaseInfoFile.FullName));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
DownloadCacheHelper.ClearMetadataCache();
|
||||
}
|
||||
}
|
||||
|
||||
var SPTReleaseInfo =
|
||||
JsonConvert.DeserializeObject<ReleaseInfo>(File.ReadAllText(SPTReleaseInfoFile.FullName));
|
||||
|
||||
if (SPTReleaseInfo == null)
|
||||
|
||||
if (sptReleaseInfo == null)
|
||||
{
|
||||
InstallButtonText = "Could not parse latest SPT release";
|
||||
InstallButtonCheckState = StatusSpinner.SpinnerState.Error;
|
||||
return;
|
||||
}
|
||||
|
||||
InstallButtonText = $"Start Install: SPT v{SPTReleaseInfo.SPTVersion}";
|
||||
InstallButtonText = $"Start Install: SPT v{sptReleaseInfo.SPTVersion}";
|
||||
InstallButtonCheckState = StatusSpinner.SpinnerState.OK;
|
||||
|
||||
AllowDetailsButton = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user