读取CPUID和网卡MAC地址源代码
public string GetCPUID()
{
string Result = "";
ManagementClass mcobject = new ManagementClass("Win32_Processor");
ManagementObjectCollection moc = mcobject.GetInstances();
foreach(ManagementObject mo in moc)
{
Result += mo.Properties["ProcessorId"].Value.ToString();
}
return Result;
}
public string GetNetcarMac()
{
string Result = "";
ManagementClass mcobject = new ManagementClass("Win32_NetworkAdapter");
ManagementObjectCollection moc = mcobject.GetInstances();
foreach(ManagementObject mo in moc)
{
if(mo["MACAddress"]!=null)
Result += mo["MACAddress"].ToString();
}
return Result;
}