2024-05-21 19:10:17 +01:00
|
|
|
|
using SPT.Common.Utils;
|
2023-11-12 13:52:54 +00:00
|
|
|
|
using Microsoft.Win32;
|
2023-03-03 18:52:31 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
2024-05-21 19:10:17 +01:00
|
|
|
|
namespace SPT.Core.Utils
|
2023-03-03 18:52:31 +00:00
|
|
|
|
{
|
|
|
|
|
public static class ValidationUtil
|
|
|
|
|
{
|
2024-08-28 12:52:54 +01:00
|
|
|
|
public static string _crashHandler = "0";
|
2024-07-25 21:58:35 +00:00
|
|
|
|
private static bool _hasRun = false;
|
|
|
|
|
|
2023-03-03 18:52:31 +00:00
|
|
|
|
public static bool Validate()
|
|
|
|
|
{
|
2024-08-28 12:52:54 +01:00
|
|
|
|
const string c0 = @"Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\EscapeFromTarkov";
|
2023-03-03 18:52:31 +00:00
|
|
|
|
var v0 = 0;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2023-12-19 20:23:07 +00:00
|
|
|
|
var v1 = Registry.LocalMachine.OpenSubKey(c0, false).GetValue("InstallLocation");
|
2023-03-03 18:52:31 +00:00
|
|
|
|
var v2 = (v1 != null) ? v1.ToString() : string.Empty;
|
2023-12-19 20:23:07 +00:00
|
|
|
|
var v3 = new DirectoryInfo(v2);
|
2024-04-17 07:49:49 +00:00
|
|
|
|
|
2023-12-19 20:23:07 +00:00
|
|
|
|
var v4 = new FileSystemInfo[]
|
2023-03-03 18:52:31 +00:00
|
|
|
|
{
|
|
|
|
|
v3,
|
2023-12-19 20:44:13 +00:00
|
|
|
|
new FileInfo(Path.Combine(v2, @"BattlEye\BEClient_x64.dll")),
|
2024-01-04 17:18:46 +00:00
|
|
|
|
new FileInfo(Path.Combine(v2, @"BattlEye\BEService_x64.exe")),
|
2023-12-19 20:44:13 +00:00
|
|
|
|
new FileInfo(Path.Combine(v2, "ConsistencyInfo")),
|
|
|
|
|
new FileInfo(Path.Combine(v2, "Uninstall.exe")),
|
|
|
|
|
new FileInfo(Path.Combine(v2, "UnityCrashHandler64.exe"))
|
2023-03-03 18:52:31 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-07-25 21:58:35 +00:00
|
|
|
|
if (!_hasRun)
|
|
|
|
|
{
|
2024-11-26 21:54:24 -08:00
|
|
|
|
_crashHandler = Gfs(v2, "UnityCrashHandler64.exe")?.Length.ToString() ?? "0";
|
|
|
|
|
ServerLog.Debug("SPT.Core", _crashHandler);
|
2024-07-25 21:58:35 +00:00
|
|
|
|
ServerLog.Debug("SPT.Core", Gfs(v2, "Uninstall.exe")?.Length.ToString() ?? "0");
|
|
|
|
|
ServerLog.Debug("SPT.Core", Gfs(v2, "Register.bat")?.Length.ToString() ?? "0");
|
|
|
|
|
_hasRun = true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-03 18:52:31 +00:00
|
|
|
|
v0 = v4.Length - 1;
|
|
|
|
|
|
|
|
|
|
foreach (var value in v4)
|
|
|
|
|
{
|
|
|
|
|
if (File.Exists(value.FullName))
|
|
|
|
|
{
|
|
|
|
|
--v0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
v0 = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return v0 == 0;
|
|
|
|
|
}
|
2023-12-27 23:57:37 +02:00
|
|
|
|
|
|
|
|
|
private static FileInfo Gfs(string p, string f)
|
|
|
|
|
{
|
|
|
|
|
var a = Path.Combine(p, f);
|
|
|
|
|
return File.Exists(a) ? new FileInfo(a) : null;
|
|
|
|
|
}
|
2023-03-03 18:52:31 +00:00
|
|
|
|
}
|
2024-04-17 07:49:49 +00:00
|
|
|
|
}
|