46 lines
1.5 KiB
C#
Raw Normal View History

using SPTInstaller.Interfaces;
2023-05-11 23:11:39 -04:00
using SPTInstaller.Models;
2022-07-09 00:33:55 -04:00
using System.Threading.Tasks;
using SPTInstaller.Helpers;
2022-07-09 00:33:55 -04:00
namespace SPTInstaller.Installer_Tasks;
2022-07-09 00:33:55 -04:00
public class InitializationTask : InstallerTaskBase
{
private InternalData _data;
2024-05-01 10:31:55 -04:00
public InitializationTask(InternalData data) : base("Startup")
{
_data = data;
}
2024-05-01 10:31:55 -04:00
public override async Task<IResult> TaskOperation()
{
SetStatus("Initializing", $"Installed EFT Game Path: {FileHelper.GetRedactedPath(_data.OriginalGamePath)}");
2024-05-01 10:31:55 -04:00
var result = PreCheckHelper.DetectOriginalGameVersion(_data.OriginalGamePath);
2024-05-01 10:31:55 -04:00
if (!result.Succeeded)
{
return result;
}
2024-05-01 10:31:55 -04:00
_data.OriginalGameVersion = result.Message;
2024-05-01 10:31:55 -04:00
SetStatus(null, $"Installed EFT Game Version: {_data.OriginalGameVersion}");
2024-05-01 10:31:55 -04:00
if (_data.OriginalGamePath == null)
{
2024-05-01 10:31:55 -04:00
return Result.FromError(
"Unable to find original EFT directory, please make sure EFT is installed. Please also run EFT once");
}
2024-05-01 10:31:55 -04:00
if (File.Exists(Path.Join(_data.TargetInstallPath, "EscapeFromTarkov.exe")))
{
2024-05-01 10:31:55 -04:00
return Result.FromError(
"Installer is located in a folder that has existing game files. Please make sure the installer is in an empty folder as per the guide");
2022-07-09 00:33:55 -04:00
}
2024-05-01 10:31:55 -04:00
return Result.FromSuccess($"Current Game Version: {_data.OriginalGameVersion}");
2022-07-09 00:33:55 -04:00
}
}