Compare commits

...

13 Commits

Author SHA1 Message Date
958eb295fb Merge pull request 'remove net6 pre-check' (#75) from waffle.lord/SPT-AKI-Installer:rm/net6-check into master
Reviewed-on: CWX/SPT-AKI-Installer#75
2024-04-23 14:49:46 +00:00
1185882a17 Update README.md 2024-04-23 14:48:56 +00:00
92cc51ee8d remove net6 pre-check 2024-04-23 10:17:54 -04:00
4811d03902 Merge pull request 'update message because reasons' (#74) from waffle.lord/SPT-AKI-Installer:update-message into master
Reviewed-on: CWX/SPT-AKI-Installer#74
2024-04-15 18:30:24 +00:00
4f933aaf0b update message because reasons 2024-04-15 14:29:25 -04:00
dbcec6125f Merge pull request 'add bsg folder to path checks' (#73) from waffle.lord/SPT-AKI-Installer:add-bsg-patch-check into master
Reviewed-on: CWX/SPT-AKI-Installer#73
2024-04-10 23:21:29 +00:00
719570a83d add bsg folder to path checks 2024-04-10 19:20:04 -04:00
723ba56cbe Merge pull request 'impr/path-checks' (#72) from waffle.lord/SPT-AKI-Installer:impr/path-checks into master
Reviewed-on: CWX/SPT-AKI-Installer#72
2024-04-06 16:54:10 +00:00
90ec2d1b4f deny cloud sync folders 2024-04-06 12:53:45 -04:00
e20ccf4b76 update 'no patcher available' message 2024-04-05 15:07:58 -04:00
8cceee6668 update path checks to allow denial or warning 2024-04-05 12:29:47 -04:00
68b895786b Merge pull request 'Fix a very rare edge case of someone running Windows on a non-C: drive letter' (#71) from DrakiaXYZ/SPT-AKI-Installer:feat-non-standard-windows into master
Reviewed-on: CWX/SPT-AKI-Installer#71

LGTM!!
2024-04-05 11:14:21 +00:00
DrakiaXYZ
262d185203 Fix a very rare edge case of someone running Windows on a non-C: drive letter 2024-04-04 19:45:53 -07:00
9 changed files with 103 additions and 55 deletions

View File

@ -1,20 +1,20 @@
# SPT-AKI Installer made for EFT. # SPT-AKI Installer made for EFT.
![Installer Image](https://media.discordapp.net/attachments/875707258074447904/1107352250705268807/image.png?width=1148&height=671) <img src="https://i.imgur.com/jtlwLsr.png" alt="spt installer 2.59" width="700"/>
### Pre install checks: ### Pre install checks:
- Checks if .net 4.7.2 (or higher) is installed - Checks if .net 4.7.2 (or higher) is installed
- Checks if .net 6 desktop runtime is installed - Checks if .net 8 runtime is installed
- Checks if EFT is installed, - Checks if EFT is installed
- Checks if there is enough space before install, - Checks if there is enough space before install
- Checks installer is not in OG game directory, - Checks installer is not in a problematic path
- Checks install folder does not have game files already in it, - Checks install folder does not have game files already in it
- Checks if gameversion matches aki version, if so skip patcher process, - Checks if gameversion matches aki version, if so skip patcher process
- Checks both zips are there, other than when the above match, patcher isnt checked for - Checks both zips are there, other than when the above match, patcher isnt checked for
- downloads both Zips from the Repo's if needed - downloads both Zips from the Repo's if needed
### Installer Processes: ### Installer Processes:
- Copies files from registry logged GamePath to new location, - Copies files from registry logged GamePath to new location
- Extracts, runs and deletes patcher with no user input, - Extracts, runs and deletes patcher with no user input
- Extracts Aki, - Extracts Aki
- Deletes both Patcher and AKI zips at the end. - Deletes both Patcher and AKI zips at the end

View File

@ -162,54 +162,49 @@ public static class FileHelper
} }
} }
private enum PathCheckType public static bool CheckPathForProblemLocations(string path, out PathCheck failedCheck)
{ {
EndsWith = 0, failedCheck = new();
Contains = 1,
DriveRoot = 2
}
public static bool CheckPathForProblemLocations(string path, out string detectedName) var problemPaths = new List<PathCheck>()
{ {
detectedName = ""; new("Documents", PathCheckType.EndsWith, PathCheckAction.Warn),
new("Desktop", PathCheckType.EndsWith, PathCheckAction.Deny),
var problemNames = new Dictionary<string, PathCheckType>() new("Battlestate Games", PathCheckType.Contains, PathCheckAction.Deny),
{ new("Desktop", PathCheckType.Contains, PathCheckAction.Warn),
{ "Documents", PathCheckType.EndsWith }, new("scoped_dir", PathCheckType.Contains, PathCheckAction.Deny),
{ "Desktop", PathCheckType.Contains }, new("Downloads", PathCheckType.Contains, PathCheckAction.Deny),
{ "scoped_dir", PathCheckType.Contains }, new("OneDrive", PathCheckType.Contains, PathCheckAction.Deny),
{ "Downloads", PathCheckType.Contains }, new("NextCloud", PathCheckType.Contains, PathCheckAction.Deny),
{ "OneDrive", PathCheckType.Contains }, new("DropBox", PathCheckType.Contains, PathCheckAction.Deny),
{ "NextCloud", PathCheckType.Contains }, new("Google", PathCheckType.Contains, PathCheckAction.Deny),
{ "DropBox", PathCheckType.Contains }, new("Program Files", PathCheckType.Contains, PathCheckAction.Deny),
{ "Google", PathCheckType.Contains }, new("Program Files (x86", PathCheckType.Contains, PathCheckAction.Deny),
{ "Program Files", PathCheckType.Contains }, new("Drive Root", PathCheckType.DriveRoot, PathCheckAction.Deny)
{ "Program Files (x86)", PathCheckType.Contains },
{ "Drive Root", PathCheckType.DriveRoot }
}; };
foreach (var name in problemNames) foreach (var check in problemPaths)
{ {
switch (name.Value) switch (check.CheckType)
{ {
case PathCheckType.EndsWith: case PathCheckType.EndsWith:
if (path.ToLower().EndsWith(name.Key.ToLower())) if (path.ToLower().EndsWith(check.Target.ToLower()))
{ {
detectedName = name.Key; failedCheck = check;
return true; return true;
} }
break; break;
case PathCheckType.Contains: case PathCheckType.Contains:
if (path.ToLower().Contains(name.Key.ToLower())) if (path.ToLower().Contains(check.Target.ToLower()))
{ {
detectedName = name.Key; failedCheck = check;
return true; return true;
} }
break; break;
case PathCheckType.DriveRoot: case PathCheckType.DriveRoot:
if (Regex.Match(path.ToLower(), @"^\w:(\\|\/)$").Success) if (Regex.Match(path.ToLower(), @"^\w:(\\|\/)$").Success)
{ {
detectedName = name.Key; failedCheck = check;
return true; return true;
} }
break; break;

View File

@ -33,7 +33,8 @@ public class Net8PreCheck : PreCheckBase
try try
{ {
var result = ProcessHelper.RunAndReadProcessOutputs(@"C:\Program Files\dotnet\dotnet.exe", "--list-runtimes"); var programFiles = Environment.ExpandEnvironmentVariables("%ProgramW6432%");
var result = ProcessHelper.RunAndReadProcessOutputs($@"{programFiles}\dotnet\dotnet.exe", "--list-runtimes");
if (!result.Succeeded) if (!result.Succeeded)
{ {

View File

@ -7,6 +7,7 @@ using SPTInstaller.Helpers;
namespace SPTInstaller.Installer_Tasks.PreChecks; namespace SPTInstaller.Installer_Tasks.PreChecks;
[Obsolete("No longer needed, but keeping around for now just in case. Can be removed from code after 7/1/2024 if no issues are found")]
public class NetCore6PreCheck : PreCheckBase public class NetCore6PreCheck : PreCheckBase
{ {
public NetCore6PreCheck() : base(".Net Core 6 Desktop Runtime", true) public NetCore6PreCheck() : base(".Net Core 6 Desktop Runtime", true)
@ -33,7 +34,8 @@ public class NetCore6PreCheck : PreCheckBase
try try
{ {
var result = ProcessHelper.RunAndReadProcessOutputs(@"C:\Program Files\dotnet\dotnet.exe", "--list-runtimes"); var programFiles = Environment.ExpandEnvironmentVariables("%ProgramW6432%");
var result = ProcessHelper.RunAndReadProcessOutputs($@"{programFiles}\dotnet\dotnet.exe", "--list-runtimes");
if (!result.Succeeded) if (!result.Succeeded)
{ {

View File

@ -60,7 +60,7 @@ public class ReleaseCheckTask : InstallerTaskBase
if (comparePatchToAki == null && patchNeedCheck) if (comparePatchToAki == null && patchNeedCheck)
{ {
return Result.FromError("No patcher available for your version"); return Result.FromError("No patcher available for your version.\nA patcher is usually created within 24 hours of an EFT update.");
} }
_data.PatchNeeded = patchNeedCheck; _data.PatchNeeded = patchNeedCheck;

View File

@ -0,0 +1,32 @@
namespace SPTInstaller.Models;
public enum PathCheckType
{
EndsWith = 0,
Contains = 1,
DriveRoot = 2
}
public enum PathCheckAction
{
Warn = 0,
Deny = 1,
}
public class PathCheck
{
public string Target { get; private set; }
public PathCheckType CheckType { get; private set; }
public PathCheckAction CheckAction { get; private set; }
public PathCheck()
{
}
public PathCheck(string target, PathCheckType checkType, PathCheckAction checkAction)
{
Target = target;
CheckType = checkType;
CheckAction = checkAction;
}
}

View File

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

View File

@ -9,8 +9,8 @@
<PackageIcon>icon.ico</PackageIcon> <PackageIcon>icon.ico</PackageIcon>
<ApplicationIcon>Assets\icon.ico</ApplicationIcon> <ApplicationIcon>Assets\icon.ico</ApplicationIcon>
<Configurations>Debug;Release;TEST</Configurations> <Configurations>Debug;Release;TEST</Configurations>
<AssemblyVersion>2.55</AssemblyVersion> <AssemblyVersion>2.59</AssemblyVersion>
<FileVersion>2.55</FileVersion> <FileVersion>2.59</FileVersion>
<Company>SPT-AKI</Company> <Company>SPT-AKI</Company>
</PropertyGroup> </PropertyGroup>

View File

@ -164,20 +164,39 @@ public class PreChecksViewModel : ViewModelBase
Task.Run(async () => Task.Run(async () =>
{ {
if (FileHelper.CheckPathForProblemLocations(InstallPath, out var detectedName)) if (FileHelper.CheckPathForProblemLocations(InstallPath, out var failedCheck ))
{
switch (failedCheck.CheckAction)
{
case PathCheckAction.Warn:
{ {
await Dispatcher.UIThread.InvokeAsync(async () => await Dispatcher.UIThread.InvokeAsync(async () =>
{ {
Log.Warning("Problem folder detected, confirming install path ..."); Log.Warning("Problem path detected, confirming install path ...");
var confirmation = await DialogHost.Show(new ConfirmationDialog($"We suspect you may be installing into a problematic folder: {detectedName}.\nYou might want to consider installing somewhere else to avoid issues.\n\nAre you sure you want to install to this path?\n{InstallPath}")); var confirmation = await DialogHost.Show(new ConfirmationDialog(
$"We suspect you may be installing into a problematic folder: {failedCheck.Target}.\nYou might want to consider installing somewhere else to avoid issues.\n\nAre you sure you want to install to this path?\n{InstallPath}"));
if (confirmation == null || !bool.TryParse(confirmation.ToString(), out var confirm) || !confirm) if (confirmation == null || !bool.TryParse(confirmation.ToString(), out var confirm) ||
!confirm)
{ {
Log.Information("User declined install path, exiting"); Log.Information("User declined install path, exiting");
Environment.Exit(0); Environment.Exit(0);
} }
}); });
break;
}
case PathCheckAction.Deny:
{
Log.Error("Problem path detected, install denied");
NavigateTo(new MessageViewModel(HostScreen, Result.FromError($"We suspect you may be installing into a problematic folder: {failedCheck.Target}.\nWe won't be letting you install here. Please move the installer to another folder.\nSuggestion: a folder under your drive root, such as 'C:\\spt\\'\nDenied Path: {InstallPath}")));
break;
}
default:
throw new ArgumentOutOfRangeException();
}
Log.Information("User accepted install path"); Log.Information("User accepted install path");
} }
}); });