mirror of
https://github.com/sp-tarkov/installer.git
synced 2025-02-12 17:10:46 -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>
|
<PackageIcon>icon.ico</PackageIcon>
|
||||||
<ApplicationIcon>Assets\spt_installer.ico</ApplicationIcon>
|
<ApplicationIcon>Assets\spt_installer.ico</ApplicationIcon>
|
||||||
<Configurations>Debug;Release;TEST</Configurations>
|
<Configurations>Debug;Release;TEST</Configurations>
|
||||||
<AssemblyVersion>2.95</AssemblyVersion>
|
<AssemblyVersion>2.96</AssemblyVersion>
|
||||||
<FileVersion>2.95</FileVersion>
|
<FileVersion>2.96</FileVersion>
|
||||||
<Company>SPT</Company>
|
<Company>SPT</Company>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -245,28 +245,43 @@ public class PreChecksViewModel : ViewModelBase
|
|||||||
|
|
||||||
var progress = new Progress<double>((d) => { });
|
var progress = new Progress<double>((d) => { });
|
||||||
|
|
||||||
var SPTReleaseInfoFile =
|
ReleaseInfo? sptReleaseInfo = null;
|
||||||
|
var retries = 1;
|
||||||
|
|
||||||
|
while (retries >= 0)
|
||||||
|
{
|
||||||
|
retries--;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sptReleaseInfoFile =
|
||||||
await DownloadCacheHelper.GetOrDownloadFileAsync("release.json", DownloadCacheHelper.ReleaseMirrorUrl,
|
await DownloadCacheHelper.GetOrDownloadFileAsync("release.json", DownloadCacheHelper.ReleaseMirrorUrl,
|
||||||
progress, DownloadCacheHelper.SuggestedTtl);
|
progress, DownloadCacheHelper.SuggestedTtl);
|
||||||
|
|
||||||
if (SPTReleaseInfoFile == null)
|
if (sptReleaseInfoFile == null)
|
||||||
{
|
{
|
||||||
InstallButtonText = "Could not get SPT release metadata";
|
InstallButtonText = "Could not get SPT release metadata";
|
||||||
InstallButtonCheckState = StatusSpinner.SpinnerState.Error;
|
InstallButtonCheckState = StatusSpinner.SpinnerState.Error;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var SPTReleaseInfo =
|
sptReleaseInfo =
|
||||||
JsonConvert.DeserializeObject<ReleaseInfo>(File.ReadAllText(SPTReleaseInfoFile.FullName));
|
JsonConvert.DeserializeObject<ReleaseInfo>(File.ReadAllText(sptReleaseInfoFile.FullName));
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
DownloadCacheHelper.ClearMetadataCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (SPTReleaseInfo == null)
|
if (sptReleaseInfo == null)
|
||||||
{
|
{
|
||||||
InstallButtonText = "Could not parse latest SPT release";
|
InstallButtonText = "Could not parse latest SPT release";
|
||||||
InstallButtonCheckState = StatusSpinner.SpinnerState.Error;
|
InstallButtonCheckState = StatusSpinner.SpinnerState.Error;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InstallButtonText = $"Start Install: SPT v{SPTReleaseInfo.SPTVersion}";
|
InstallButtonText = $"Start Install: SPT v{sptReleaseInfo.SPTVersion}";
|
||||||
InstallButtonCheckState = StatusSpinner.SpinnerState.OK;
|
InstallButtonCheckState = StatusSpinner.SpinnerState.OK;
|
||||||
|
|
||||||
AllowDetailsButton = true;
|
AllowDetailsButton = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user