From ae08be8367137357605fe553491cba5f4a198597 Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Sun, 30 Jun 2024 12:12:08 -0400 Subject: [PATCH] add eft install precheck also updated wording of free space precheck when eft install isn't found --- .../PreChecks/EftInstalledPreCheck.cs | 24 +++++++++++++++++++ .../PreChecks/FreeSpacePreCheck.cs | 2 +- SPTInstaller/Program.cs | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 SPTInstaller/Installer Tasks/PreChecks/EftInstalledPreCheck.cs diff --git a/SPTInstaller/Installer Tasks/PreChecks/EftInstalledPreCheck.cs b/SPTInstaller/Installer Tasks/PreChecks/EftInstalledPreCheck.cs new file mode 100644 index 0000000..f6926ed --- /dev/null +++ b/SPTInstaller/Installer Tasks/PreChecks/EftInstalledPreCheck.cs @@ -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 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"); + } +} \ No newline at end of file diff --git a/SPTInstaller/Installer Tasks/PreChecks/FreeSpacePreCheck.cs b/SPTInstaller/Installer Tasks/PreChecks/FreeSpacePreCheck.cs index cc2ddde..2e24368 100644 --- a/SPTInstaller/Installer Tasks/PreChecks/FreeSpacePreCheck.cs +++ b/SPTInstaller/Installer Tasks/PreChecks/FreeSpacePreCheck.cs @@ -33,7 +33,7 @@ public class FreeSpacePreCheck : PreCheckBase 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() diff --git a/SPTInstaller/Program.cs b/SPTInstaller/Program.cs index 99c9c75..ca4306e 100644 --- a/SPTInstaller/Program.cs +++ b/SPTInstaller/Program.cs @@ -44,6 +44,7 @@ internal class Program ServiceHelper.Register(); #if !TEST + ServiceHelper.Register(); ServiceHelper.Register(); ServiceHelper.Register(); ServiceHelper.Register();