failsafe load dlls

add user config queue offsets
throttle improvements
This commit is contained in:
Alex Bezdieniezhnykh
2025-04-17 01:19:48 +03:00
parent 0237e279a5
commit 0c66607ed7
32 changed files with 320 additions and 188 deletions
@@ -38,29 +38,20 @@ public class HardwareService : IHardwareService
.Replace("Name=", "")
.Replace(" ", " ")
.Trim()
.Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries);
.Split(['\n', '\r'], StringSplitOptions.RemoveEmptyEntries)
.Select(x => x.Trim())
.ToArray();
var memoryStr = "Unknown RAM";
if (lines.Length > 0)
{
memoryStr = lines[0];
if (int.TryParse(memoryStr, out var memKb))
memoryStr = $"{Math.Round(memKb / 1024.0 / 1024.0)} Gb";
}
if (lines.Length < 3)
throw new Exception("Can't get hardware info");
var macAddress = MacAddress();
var hardwareInfo = new HardwareInfo
{
Memory = memoryStr,
CPU = lines.Length > 1 && string.IsNullOrEmpty(lines[1])
? "Unknown CPU"
: lines[1].Trim(),
GPU = lines.Length > 2 && string.IsNullOrEmpty(lines[2])
? "Unknown GPU"
: lines[2],
MacAddress = macAddress
CPU = lines[0],
GPU = lines[1],
Memory = lines[2],
MacAddress = GetMacAddress()
};
hardwareInfo.Hash = ToHash($"Az|{hardwareInfo.CPU}|{hardwareInfo.GPU}|{macAddress}");
return hardwareInfo;
}
catch (Exception ex)
@@ -70,7 +61,7 @@ public class HardwareService : IHardwareService
}
}
private string MacAddress()
private string GetMacAddress()
{
var macAddress = NetworkInterface
.GetAllNetworkInterfaces()