示例#1
0
        /// <summary>
        /// Get a single computer's Win32 properties
        /// </summary>
        /// <param name="wmi"></param>
        /// <returns></returns>
        static Computer GetComputerProperties(WMI wmi)
        {
            var queries = new Dictionary<string, string>()
            {
                {"Baseboard","SELECT Manufacturer,Model,Product,SerialNumber FROM Win32_BaseBoard"},
                {"BIOS","SELECT Manufacturer,SerialNumber,SMBIOSBIOSVersion FROM Win32_BIOS"},
                {"DiskDrive","SELECT Model,Size,Manufacturer FROM Win32_DiskDrive"},
                {"MotherboardDevice", "SELECT PrimaryBusType,SecondaryBusType FROM Win32_MotherboardDevice"},
                //{"OperatingSystem","SELECT * FROM Win32_OperatingSystem"},
                {"PhysicalMemory","SELECT Capacity,DataWidth,FormFactor,MemoryType,Speed FROM Win32_PhysicalMemory"},
                {"Processor","SELECT Manufacturer,Name,Description,MaxClockSpeed,L2CacheSize,AddressWidth,DataWidth,NumberOfCores,NumberOfLogicalProcessors,ProcessorId FROM Win32_Processor"},
                {"VideoController","SELECT AdapterCompatibility,AdapterRAM,Name,VideoModeDescription,VideoProcessor,VideoMemoryType FROM Win32_VideoController"}
            };

            var computer = new Computer() {
                Baseboard = new Baseboard(wmi.GetQueryResult(queries["Baseboard"])),
                BIOS = new BIOS(wmi.GetQueryResult(queries["BIOS"])),
                DiskDrive = new DiskDrive(wmi.GetQueryResult(queries["DiskDrive"])),
                MotherboardDevice = new MotherboardDevice(wmi.GetQueryResult(queries["MotherboardDevice"])),
                PhysicalMemory = new PhysicalMemory(wmi.GetQueryResult(queries["PhysicalMemory"])),
                Processor = new Processor(wmi.GetQueryResult(queries["Processor"])),
                VideoController = new VideoController(wmi.GetQueryResult(queries["VideoController"]))
            };

            return computer;
        }
示例#2
0
 public Computer GetPreviousRecord(Computer computer)
 {
     throw new NotImplementedException();
 }
示例#3
0
 public bool SaveRecord(Computer computer)
 {
     throw new NotImplementedException();
 }
示例#4
0
 public bool CompareRecords(Computer a, Computer b)
 {
     throw new NotImplementedException();
 }