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 &