made adjustments to not need patcher on current release

This commit is contained in:
CWX 2022-07-25 00:04:48 +01:00
parent a6a6160b16
commit 87dd6edea4

View File

@ -17,13 +17,21 @@ namespace SPT_AKI_Installer.Aki.Core.Tasks
} }
public override async Task<GenericResult> RunAsync() public override async Task<GenericResult> RunAsync()
{
var targetInstallDirInfo = new DirectoryInfo(_data.TargetInstallPath);
var patcherOutputDir = new DirectoryInfo(Path.Join(_data.TargetInstallPath, "patcher"));
var patcherEXE = new FileInfo(Path.Join(_data.TargetInstallPath, "patcher.exe"));
if (_data.PatchNeeded)
{ {
// extract patcher files // extract patcher files
SetStatus("Extrating Patcher", false); SetStatus("Extrating Patcher", false);
var extractPatcherProgress = new Progress<double>((d) => { Progress = (int)Math.Floor(d); }); var extractPatcherProgress = new Progress<double>((d) => { Progress = (int)Math.Floor(d); });
var patcherOutputDir = new DirectoryInfo(Path.Join(_data.TargetInstallPath, "patcher"));
var extractPatcherResult = ZipHelper.Decompress(_data.PatcherZipInfo, patcherOutputDir, extractPatcherProgress); var extractPatcherResult = ZipHelper.Decompress(_data.PatcherZipInfo, patcherOutputDir, extractPatcherProgress);
@ -36,7 +44,7 @@ namespace SPT_AKI_Installer.Aki.Core.Tasks
SetStatus("Copying Patcher", false); SetStatus("Copying Patcher", false);
var patcherDirInfo = patcherOutputDir.GetDirectories("Patcher*", SearchOption.TopDirectoryOnly).First(); var patcherDirInfo = patcherOutputDir.GetDirectories("Patcher*", SearchOption.TopDirectoryOnly).First();
var targetInstallDirInfo = new DirectoryInfo(_data.TargetInstallPath);
var copyPatcherProgress = new Progress<double>((d) => { Progress = (int)Math.Floor(d); }); var copyPatcherProgress = new Progress<double>((d) => { Progress = (int)Math.Floor(d); });
@ -51,8 +59,6 @@ namespace SPT_AKI_Installer.Aki.Core.Tasks
SetStatus("Running Patcher"); SetStatus("Running Patcher");
StartDrawingIndeterminateProgress(); StartDrawingIndeterminateProgress();
var patcherEXE = new FileInfo(Path.Join(_data.TargetInstallPath, "patcher.exe"));
var patchingResult = ProcessHelper.PatchClientFiles(patcherEXE, targetInstallDirInfo); var patchingResult = ProcessHelper.PatchClientFiles(patcherEXE, targetInstallDirInfo);
if (!patchingResult.Succeeded) if (!patchingResult.Succeeded)
@ -60,6 +66,10 @@ namespace SPT_AKI_Installer.Aki.Core.Tasks
return patchingResult; return patchingResult;
} }
}
// extract release files // extract release files
SetStatus("Extracting Release"); SetStatus("Extracting Release");
StartDrawingProgress(); StartDrawingProgress();
@ -70,17 +80,21 @@ namespace SPT_AKI_Installer.Aki.Core.Tasks
if (!extractReleaseResult.Succeeded) if (!extractReleaseResult.Succeeded)
{ {
return extractPatcherResult; return extractReleaseResult;
} }
// cleanup temp files // cleanup temp files
SetStatus("Cleanup"); SetStatus("Cleanup");
StartDrawingIndeterminateProgress(); StartDrawingIndeterminateProgress();
if(_data.PatchNeeded)
{
patcherOutputDir.Delete(true); patcherOutputDir.Delete(true);
patcherEXE.Delete();
}
_data.PatcherZipInfo.Delete(); _data.PatcherZipInfo.Delete();
_data.AkiZipInfo.Delete(); _data.AkiZipInfo.Delete();
patcherEXE.Delete();
return GenericResult.FromSuccess("SPT is Setup. Happy Playing!"); return GenericResult.FromSuccess("SPT is Setup. Happy Playing!");
} }