move original game check to precheckviewmodel, fix drives showing no space available

This commit is contained in:
IsWaffle 2023-07-27 10:03:24 -04:00
parent 886770253a
commit b901975826
4 changed files with 10 additions and 13 deletions

View File

@ -13,7 +13,7 @@ public static class DirectorySizeHelper
var installTargetDirectoryInfo = new DirectoryInfo(installTargetDirPath); var installTargetDirectoryInfo = new DirectoryInfo(installTargetDirPath);
var eftSourceDirSize = GetSizeOfDirectory(eftSourceDirectoryInfo); var eftSourceDirSize = GetSizeOfDirectory(eftSourceDirectoryInfo);
var availableSize = DriveInfo.GetDrives().FirstOrDefault(d => d.Name == installTargetDirectoryInfo.Root.Name)?.AvailableFreeSpace ?? 0; var availableSize = DriveInfo.GetDrives().FirstOrDefault(d => d.Name.ToLower() == installTargetDirectoryInfo.Root.Name.ToLower())?.AvailableFreeSpace ?? 0;
return eftSourceDirSize < availableSize; return eftSourceDirSize < availableSize;
} }

View File

@ -16,16 +16,7 @@ public class InitializationTask : InstallerTaskBase
public override async Task<IResult> TaskOperation() public override async Task<IResult> TaskOperation()
{ {
SetStatus("Initializing", $"Target Install Path: {FileHelper.GetRedactedPath(_data.TargetInstallPath)}"); SetStatus("Initializing", $"Installed EFT Game Path: {FileHelper.GetRedactedPath(_data.OriginalGamePath)}");
_data.OriginalGamePath = PreCheckHelper.DetectOriginalGamePath();
if (_data.OriginalGamePath == null)
{
return Result.FromError("EFT IS NOT INSTALLED!");
}
SetStatus(null, $"Installed EFT Game Path: {FileHelper.GetRedactedPath(_data.OriginalGamePath)}");
var result = PreCheckHelper.DetectOriginalGameVersion(_data.OriginalGamePath); var result = PreCheckHelper.DetectOriginalGameVersion(_data.OriginalGamePath);

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.3</AssemblyVersion> <AssemblyVersion>2.4</AssemblyVersion>
<FileVersion>2.3</FileVersion> <FileVersion>2.4</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -39,6 +39,12 @@ public class PreChecksViewModel : ViewModelBase
} }
data.OriginalGamePath = PreCheckHelper.DetectOriginalGamePath(); data.OriginalGamePath = PreCheckHelper.DetectOriginalGamePath();
if (data.OriginalGamePath == null)
{
NavigateTo(new MessageViewModel(HostScreen, Result.FromError("Could not find EFT install.\n\nDo you own and have the game installed?")));
}
data.TargetInstallPath = Environment.CurrentDirectory; data.TargetInstallPath = Environment.CurrentDirectory;
InstallPath = data.TargetInstallPath; InstallPath = data.TargetInstallPath;