public static List<HardDrive> hdCollection = new List<HardDrive>(); private static void GetAllDiskDrives() { var searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive"); hdCollection.Clear(); foreach (ManagementObject wmi_HD in searcher.Get()) { HardDrive hd = new HardDrive(); hd.Model = wmi_HD["Model"].ToString(); hd.InterfaceType = wmi_HD["InterfaceType"].ToString(); hd.Caption = wmi_HD["Caption"].ToString(); hd.SerialNo = wmi_HD.GetPropertyValue("SerialNumber").ToString();//get the serailNumber of diskdrive hdCollection.Add(hd); } } public class HardDrive { public string Model { get; set; } public string InterfaceType { get; set; } public string Caption { get; set; } public string SerialNo { get; set; } } public static string getUniqueDeviceID() { GetAllDiskDrives(); var HDDData = hdCollection.FirstOrDefault(); string HDDSerial = HDDData.Model + HDDData.SerialNo; string Combine = CPU_Serial + MotherBoardID + HDDSerial; string hash = ConvertTextToHash(Combine); return hash; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)