public CpuInfo GetInfo() { Dictionary <string, string>[] dicProperties = GeneralStaticMethods.GetHardWareInfo <CpuInfo>("Win32_processor"); this.Name = dicProperties[0]["Name"]; this.ProcessorId = dicProperties[0]["ProcessorId"]; return(new CpuInfo { Name = this.Name, ProcessorId = this.ProcessorId }); }
public MainBoardInfo GetInfo() { Dictionary <string, string>[] dicProperties1 = GeneralStaticMethods.GetHardWareInfo <MainBoardInfo>("Win32_baseboard"); Dictionary <string, string>[] dicProperties2 = GeneralStaticMethods.GetHardWareInfo <MainBoardInfo>("Win32_bios"); this.Product = dicProperties1[0]["Product"]; this.SerialNumber = GeneralStaticMethods.GetSerialNumber(TypeHW.MainBoard, dicProperties1[0]["SerialNumber"]); this.Manufacturer = NameManufacturer(dicProperties1[0]["Manufacturer"]); this.SMBIOSBIOSVersion = dicProperties2[0]["SMBIOSBIOSVersion"]; this.MAC = MACAdresses(this.Manufacturer); return(new MainBoardInfo { Product = this.Product, SerialNumber = this.SerialNumber, Manufacturer = this.Manufacturer, SMBIOSBIOSVersion = this.SMBIOSBIOSVersion, MAC = this.MAC }); }
public List <DiskInfo> GetStorage() { List <DiskInfo> storages = new List <DiskInfo>(); int indexDisk = 0; string pattern = "^ATA | ATA Device| SCSI Disk Device"; string model = String.Empty; bool isSSD; Dictionary <string, string>[] dicProperties = GeneralStaticMethods.GetHardWareInfo <DiskInfo>("Win32_DiskDrive"); if (dicProperties != null) { foreach (Dictionary <string, string> dicprop in dicProperties) { if (dicprop["InterfaceType"] != "USB") { indexDisk = int.Parse(dicprop["Index"]); Console.WriteLine(indexDisk); model = Regex.Replace(dicprop["Model"], pattern, "", RegexOptions.IgnoreCase).Trim(); Console.WriteLine(model); Console.WriteLine(dicprop["InterfaceType"]); if (dicprop["InterfaceType"] == "SCSI") { isSSD = CheckStorageIsSSD.HasNoSeekPenalty($"\\\\.\\PhysicalDrive{indexDisk}"); } else { isSSD = CheckStorageIsSSD.HasNominalMediaRotationRate($"\\\\.\\PhysicalDrive{indexDisk}"); } storages.Add(new DiskInfo { Model = model, Index = indexDisk, IsSSD = isSSD, Size = (int)(long.Parse(dicprop["Size"]) / (1024 * 1024 * 1024)), InterfaceType = dicprop["InterfaceType"] }); } } return(storages); } else { return(null); } }
public List <DetailPartInfo> GetDetailPartInfos() { List <DetailPartInfo> detailinfo = new List <DetailPartInfo>(); string dependent = String.Empty; string antecedent = string.Empty; Dictionary <string, string>[] dicProperties = GeneralStaticMethods.GetHardWareInfo <DetailPartInfo>("win32_logicalDisktoPartition"); foreach (Dictionary <string, string> dicprop in dicProperties) { dependent = dicprop["Dependent"]; antecedent = dicprop["Antecedent"]; detailinfo.Add(new DetailPartInfo { Dependent = dependent, Antecedent = antecedent }); } return(detailinfo); }
public List <RAMInfo> GetRAM() { List <RAMInfo> totalRAM = new List <RAMInfo>(); Dictionary <string, string>[] dicProperties1 = GeneralStaticMethods.GetHardWareInfo <RAMInfo>("Win32_PhysicalMemory"); if (dicProperties1 != null) { foreach (Dictionary <string, string> dicprop in dicProperties1) { totalRAM.Add(new RAMInfo { Tag = dicprop["Tag"], PartNumber = dicprop["PartNumber"], Capacity = (int)(long.Parse(dicprop["Capacity"]) / (1024 * 1024 * 1024)) }); } return(totalRAM); } else { return(null); } }