/// <summary> /// 获取硬件信息标识 /// </summary> public static HardwareInfo GetHardwareInfo() { var cpuId = new ManagementClass(WMIPath.Win32_Processor.ToString()).GetInstances() .Cast <ManagementObject>().Select(cpu => cpu.Properties["ProcessorId"].Value).First(); var boardId = new ManagementClass(WMIPath.Win32_BaseBoard.ToString()).GetInstances() .Cast <ManagementObject>().Select(disk => disk.Properties["SerialNumber"].Value).First(); var diskId = new ManagementClass(WMIPath.Win32_DiskDrive.ToString()).GetInstances() .Cast <ManagementObject>().Select(disk => disk.Properties["SerialNumber"].Value).First(); return(new HardwareInfo { CpuId = cpuId.ToString(), BoardId = boardId.ToString(), DiskId = diskId.ToString() }); }