mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 17:46:36 +00:00
failsafe load dlls
add user config queue offsets throttle improvements
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user