update to check that EXE exists in path folder
This commit is contained in:
parent
87dd6edea4
commit
f13f83451a
@ -23,7 +23,14 @@ namespace SPT_AKI_Installer.Aki.Core.Tasks
|
|||||||
return GenericResult.FromError("EFT IS NOT INSTALLED!");
|
return GenericResult.FromError("EFT IS NOT INSTALLED!");
|
||||||
}
|
}
|
||||||
|
|
||||||
_data.OriginalGameVersion = PreCheckHelper.DetectOriginalGameVersion(_data.OriginalGamePath);
|
var result = PreCheckHelper.DetectOriginalGameVersion(_data.OriginalGamePath);
|
||||||
|
|
||||||
|
if (!result.Succeeded)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
_data.OriginalGameVersion = result.Message;
|
||||||
|
|
||||||
if (_data.OriginalGamePath == null)
|
if (_data.OriginalGamePath == null)
|
||||||
{
|
{
|
||||||
@ -40,6 +47,7 @@ namespace SPT_AKI_Installer.Aki.Core.Tasks
|
|||||||
return GenericResult.FromError("Installer is located in a Folder that has existing Game Files. Please make sure the installer is in a fresh folder as per the guide");
|
return GenericResult.FromError("Installer is located in a Folder that has existing Game Files. Please make sure the installer is in a fresh folder as per the guide");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return GenericResult.FromSuccess($"Current Game Version: {_data.OriginalGameVersion}");
|
return GenericResult.FromSuccess($"Current Game Version: {_data.OriginalGameVersion}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
using SPT_AKI_Installer.Aki.Core.Model;
|
||||||
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@ -22,9 +24,17 @@ namespace SPT_AKI_Installer.Aki.Helper
|
|||||||
return info?.DirectoryName;
|
return info?.DirectoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string DetectOriginalGameVersion(string gamePath)
|
public static GenericResult DetectOriginalGameVersion(string gamePath)
|
||||||
{
|
{
|
||||||
return FileVersionInfo.GetVersionInfo(Path.Join(gamePath + "/EscapeFromTarkov.exe")).ProductVersion.Replace('-', '.').Split('.')[^2];
|
try
|
||||||
|
{
|
||||||
|
string version = FileVersionInfo.GetVersionInfo(Path.Join(gamePath + "/EscapeFromTarkov.exe")).ProductVersion.Replace('-', '.').Split('.')[^2];
|
||||||
|
return GenericResult.FromSuccess(version);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return GenericResult.FromError($"File not found: {ex.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user