0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00
modules/project/Aki.Core/Utils/ValidationUtil.cs

54 lines
1.7 KiB
C#
Raw Normal View History

2023-11-12 13:52:54 +00:00
using Aki.Common.Utils;
using BepInEx.Logging;
using Microsoft.Win32;
2023-03-03 18:52:31 +00:00
using System.IO;
namespace Aki.Core.Utils
{
public static class ValidationUtil
{
public static bool Validate()
{
var c0 = @"Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\EscapeFromTarkov";
var v0 = 0;
try
{
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;
var v3 = new DirectoryInfo(v2);
2023-12-19 20:44:13 +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")),
new FileInfo(Path.Combine(v2, @"BattlEye\BEService_x64.dll")),
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
};
2023-12-19 20:44:13 +00:00
ServerLog.Debug("Aki.Core", new FileInfo(Path.Combine(v2, "UnityCrashHandler64.exe")).Length.ToString());
ServerLog.Debug("Aki.Core", new FileInfo(Path.Combine(v2, "Uninstall.exe")).Length.ToString());
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;
}
}
}