public static string GetHardInfo()
{
string text = "";
string s = "";
string text2 = "";
string text3 = "";
string text4 = "";
string result;
try
{
s = "$#&%@#2@Dk";
ManagementClass managementClass = new ManagementClass("Win32_BaseBoard");
ManagementObjectCollection instances = managementClass.GetInstances();
foreach (ManagementBaseObject managementBaseObject in instances)
{
text2 = ((ManagementObject)managementBaseObject).Properties["SerialNumber"].Value.ToString();
}
managementClass.Dispose();
instances.Dispose();
if (string.IsNullOrWhiteSpace(text2))
{
text2 = "*&P$Aewr%#";
}
if (text2.Length < 10)
{
text2 += "*&P$Aewr%#";
}
text2 = text2.Substring(0, 10);
ManagementClass managementClass2 = new ManagementClass("Win32_Processor");
ManagementObjectCollection instances2 = managementClass2.GetInstances();
foreach (ManagementBaseObject managementBaseObject2 in instances2)
{
text3 = ((ManagementObject)managementBaseObject2).Properties["ProcessorId"].Value.ToString();
}
managementClass2.Dispose();
instances2.Dispose();
if (string.IsNullOrWhiteSpace(text3))
{
text3 = "Hz&*64$%g5";
}
if (text3.Length < 10)
{
text3 += "Hz&*64$%g5";
}
text3 = text3.Substring(0, 10);
ManagementClass managementClass3 = new ManagementClass("Win32_BIOS");
ManagementObjectCollection instances3 = managementClass3.GetInstances();
foreach (ManagementBaseObject managementBaseObject3 in instances3)
{
text4 = ((ManagementObject)managementBaseObject3).Properties["SerialNumber"].Value.ToString();
}
managementClass3.Dispose();
instances3.Dispose();
if (string.IsNullOrWhiteSpace(text4))
{
text4 = "3S@#Fy%u$q";
}
if (text4.Length < 10)
{
text4 += "3S@#Fy%u$q";
}
text4 = text4.Substring(0, 10);
byte[] bytes = Encoding.ASCII.GetBytes(s);
byte[] bytes2 = Encoding.ASCII.GetBytes(text2);
byte[] bytes3 = Encoding.ASCII.GetBytes(text3);
byte[] bytes4 = Encoding.ASCII.GetBytes(text4);
for (int i = 0; i < 10; i++)
{
int num = Math.Abs((int)(bytes[i] - bytes2[9 - i]));
int num2 = Math.Abs((int)(bytes2[i] - bytes4[9 - i]));
int num3 = Math.Abs((int)(bytes3[i] - bytes[9 - i]));
int num4 = Math.Abs((int)(bytes4[i] - bytes[9 - i]));
if (num <= 47 || num >= 58)
{
if (num > 25)
{
num %= 26;
}
num += 65;
}
if (num2 <= 65 || num2 >= 90)
{
if (num2 > 9)
{
num2 %= 10;
}
num2 += 48;
}
if (num3 <= 47 || num3 >= 58)
{
if (num3 > 25)
{
num3 %= 26;
}
num3 += 65;
}
if (num4 <= 65 || num4 >= 90)
{
if (num4 > 9)
{
num4 %= 10;
}
num4 += 48;
}
text = string.Concat(new string[]
{
text,
((char)num).ToString(),
((char)num2).ToString(),
((char)num3).ToString(),
((char)num4).ToString(),
"-"
});
}
goto IL_3A3;
}
catch (Exception ex)
{
result = "获取硬件信息失败!" + ex.Message;
}
return result;
IL_3A3:
if (text.Length > 1)
{
text = text.Substring(0, text.Length - 1);
}
return text;
} |