made adjustments to not need patcher on current release
This commit is contained in:
parent
a6a6160b16
commit
87dd6edea4
@ -18,48 +18,58 @@ namespace SPT_AKI_Installer.Aki.Core.Tasks
|
|||||||
|
|
||||||
public override async Task<GenericResult> RunAsync()
|
public override async Task<GenericResult> RunAsync()
|
||||||
{
|
{
|
||||||
// extract patcher files
|
var targetInstallDirInfo = new DirectoryInfo(_data.TargetInstallPath);
|
||||||
SetStatus("Extrating Patcher", false);
|
|
||||||
|
|
||||||
var extractPatcherProgress = new Progress<double>((d) => { Progress = (int)Math.Floor(d); });
|
|
||||||
|
|
||||||
var patcherOutputDir = new DirectoryInfo(Path.Join(_data.TargetInstallPath, "patcher"));
|
var patcherOutputDir = new DirectoryInfo(Path.Join(_data.TargetInstallPath, "patcher"));
|
||||||
|
|
||||||
var extractPatcherResult = ZipHelper.Decompress(_data.PatcherZipInfo, patcherOutputDir, extractPatcherProgress);
|
|
||||||
|
|
||||||
if (!extractPatcherResult.Succeeded)
|
|
||||||
{
|
|
||||||
return extractPatcherResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy patcher files to install directory
|
|
||||||
SetStatus("Copying Patcher", false);
|
|
||||||
|
|
||||||
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 copyPatcherResult = FileHelper.CopyDirectoryWithProgress(patcherDirInfo, targetInstallDirInfo, copyPatcherProgress);
|
|
||||||
|
|
||||||
if (!copyPatcherResult.Succeeded)
|
|
||||||
{
|
|
||||||
return copyPatcherResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
// run patcher
|
|
||||||
SetStatus("Running Patcher");
|
|
||||||
StartDrawingIndeterminateProgress();
|
|
||||||
|
|
||||||
var patcherEXE = new FileInfo(Path.Join(_data.TargetInstallPath, "patcher.exe"));
|
var patcherEXE = new FileInfo(Path.Join(_data.TargetInstallPath, "patcher.exe"));
|
||||||
|
|
||||||
var patchingResult = ProcessHelper.PatchClientFiles(patcherEXE, targetInstallDirInfo);
|
if (_data.PatchNeeded)
|
||||||
|
|
||||||
if (!patchingResult.Succeeded)
|
|
||||||
{
|
{
|
||||||
return patchingResult;
|
// extract patcher files
|
||||||
|
SetStatus("Extrating Patcher", false);
|
||||||
|
|
||||||
|
var extractPatcherProgress = new Progress<double>((d) => { Progress = (int)Math.Floor(d); });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var extractPatcherResult = ZipHelper.Decompress(_data.PatcherZipInfo, patcherOutputDir, extractPatcherProgress);
|
||||||
|
|
||||||
|
if (!extractPatcherResult.Succeeded)
|
||||||
|
{
|
||||||
|
return extractPatcherResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy patcher files to install directory
|
||||||
|
SetStatus("Copying Patcher", false);
|
||||||
|
|
||||||
|
var patcherDirInfo = patcherOutputDir.GetDirectories("Patcher*", SearchOption.TopDirectoryOnly).First();
|
||||||
|
|
||||||
|
|
||||||
|
var copyPatcherProgress = new Progress<double>((d) => { Progress = (int)Math.Floor(d); });
|
||||||
|
|
||||||
|
var copyPatcherResult = FileHelper.CopyDirectoryWithProgress(patcherDirInfo, targetInstallDirInfo, copyPatcherProgress);
|
||||||
|
|
||||||
|
if (!copyPatcherResult.Succeeded)
|
||||||
|
{
|
||||||
|
return copyPatcherResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// run patcher
|
||||||
|
SetStatus("Running Patcher");
|
||||||
|
StartDrawingIndeterminateProgress();
|
||||||
|
|
||||||
|
var patchingResult = ProcessHelper.PatchClientFiles(patcherEXE, targetInstallDirInfo);
|
||||||
|
|
||||||
|
if (!patchingResult.Succeeded)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
|
||||||
patcherOutputDir.Delete(true);
|
if(_data.PatchNeeded)
|
||||||
|
{
|
||||||
|
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!");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user