1 /// <summary>
2 /// 机器码
3 /// </summary>
4 public class MachineCode
5 {
6 /// <summary>
7 /// 获取cpu序列号
8 /// </summary>
9 /// <returns> string </returns>
10 public string GetCpuInfo()
11 {
12 string cpuInfo = " ";
13 using (ManagementClass cimobject = new ManagementClass("Win32_Processor"))
14 {
15 ManagementObjectCollection moc = cimobject.GetInstances();
16
17 foreach (ManagementObject mo in moc)
18 {
19 cpuInfo = mo.Properties["ProcessorId"].Value.ToString();
20 mo.Dispose();
21 }
22 }
23 return cpuInfo.ToString();
24 }
25
26 /// <summary>
27 /// 获取硬盘ID
28 /// </summary>
29 /// <returns> string </returns>
30