Philipp Heenemann
d3767a0344
Global System and System.IO usages have been replaced with global usings in GlobalUsings.cs for improved code readability. Alongside, a FreeSpacePreCheck has been added in FreeSpacePreCheck.cs to ensure enough drive space is available before installation. This check was initially taking place in InitializationTask.cs which has been removed for better separation of concerns. The PreCheckViewModel visibility is now dependent on the success status of PreChecks, enhancing user experience.
25 lines
701 B
C#
25 lines
701 B
C#
using System.Threading.Tasks;
|
|
using SPTInstaller.Helpers;
|
|
using SPTInstaller.Models;
|
|
|
|
namespace SPTInstaller.Installer_Tasks.PreChecks;
|
|
|
|
public class FreeSpacePreCheck : PreCheckBase
|
|
{
|
|
private readonly InternalData _internalData;
|
|
|
|
public FreeSpacePreCheck(InternalData internalData) : base("Free Space", true)
|
|
{
|
|
_internalData = internalData;
|
|
}
|
|
|
|
public override async Task<bool> CheckOperation()
|
|
{
|
|
if (_internalData.OriginalGamePath is null || _internalData.TargetInstallPath is null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return DirectorySizeHelper.CheckAvailableSize(_internalData.OriginalGamePath, _internalData.TargetInstallPath);
|
|
}
|
|
} |