add eft install precheck

also updated wording of free space precheck when eft install isn't found
This commit is contained in:
IsWaffle 2024-06-30 12:12:08 -04:00
parent ff717aab73
commit ae08be8367
3 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,24 @@
using System.Threading.Tasks;
using SPTInstaller.Models;
namespace SPTInstaller.Installer_Tasks.PreChecks;
public class EftInstalledPreCheck : PreCheckBase
{
private InternalData _internalData;
public EftInstalledPreCheck(InternalData data) : base("EFT Installed", true)
{
_internalData = data;
}
public override async Task<PreCheckResult> CheckOperation()
{
if (_internalData.OriginalGamePath is null || !Directory.Exists(_internalData.OriginalGamePath) || !File.Exists(Path.Join(_internalData.OriginalGamePath, "Escapefromtarkov.exe")))
{
return PreCheckResult.FromError("EFT installation could not be found", "Retry", RequestReevaluation);
}
return PreCheckResult.FromSuccess("EFT install folder found");
}
}

View File

@ -33,7 +33,7 @@ public class FreeSpacePreCheck : PreCheckBase
if (eftSourceDirSize == -1) if (eftSourceDirSize == -1)
{ {
return PreCheckResult.FromError("An error occurred while getting the EFT source directory size"); return PreCheckResult.FromError("An error occurred while getting the EFT source directory size. This is most likely because EFT is not installed");
} }
var availableSize = DriveInfo.GetDrives() var availableSize = DriveInfo.GetDrives()

View File

@ -44,6 +44,7 @@ internal class Program
ServiceHelper.Register<InternalData>(); ServiceHelper.Register<InternalData>();
#if !TEST #if !TEST
ServiceHelper.Register<PreCheckBase, EftInstalledPreCheck>();
ServiceHelper.Register<PreCheckBase, NetFramework472PreCheck>(); ServiceHelper.Register<PreCheckBase, NetFramework472PreCheck>();
ServiceHelper.Register<PreCheckBase, Net8PreCheck>(); ServiceHelper.Register<PreCheckBase, Net8PreCheck>();
ServiceHelper.Register<PreCheckBase, FreeSpacePreCheck>(); ServiceHelper.Register<PreCheckBase, FreeSpacePreCheck>();