Serial protection based on machine ID
using System.Management;
///
/// Returns the processor ID of the first
/// CPU found on the machine
///
public static string CpuInfo()
{
string cpuInfo = String.Empty;
ManagementClass managementClass =
new ManagementClass("Win32_Processor");
ManagementObjectCollection managementObjCol =
managementClass.GetInstances();
foreach(ManagementObject managementObj in managementObjCol)
{
if(cpuInfo==String.Empty)
{
cpuInfo =
managementObj.Properties["ProcessorId"].Value.ToString();
}
}
return cpuInfo;
}
///
/// Returns the processor ID of the first
/// CPU found on the machine
///
public static string CpuInfo()
{
string cpuInfo = String.Empty;
ManagementClass managementClass =
new ManagementClass("Win32_Processor");
ManagementObjectCollection managementObjCol =
managementClass.GetInstances();
foreach(ManagementObject managementObj in managementObjCol)
{
if(cpuInfo==String.Empty)
{
cpuInfo =
managementObj.Properties["ProcessorId"].Value.ToString();
}
}
return cpuInfo;
}

0 Comments:
Post a Comment
<< Home