Пример #1
0
        internal DeviceInfo(DeviceInfoSet devInfoSet, SP_DEVINFO_DATA devInfo)
        {
            DeviceDescription = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.Device_DeviceDesc) as DevicePropertyValueString)?.Value;

            var deviceHardwareIds = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.Device_HardwareIds) as DevicePropertyValueStringList)?.Value;

            if (deviceHardwareIds != null)
            {
                DeviceHardwareIds = deviceHardwareIds;
            }

            DeviceManufacturer = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.Device_Manufacturer) as DevicePropertyValueString)?.Value;
            DeviceLocationInfo = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.Device_LocationInfo) as DevicePropertyValueString)?.Value;

            var deviceLocationPaths = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.Device_LocationPaths) as DevicePropertyValueStringList)?.Value;

            if (deviceLocationPaths != null)
            {
                DeviceLocationPaths = deviceLocationPaths;
            }

            DeviceInstanceId = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.DeviceInstance_Id) as DevicePropertyValueString)?.Value;

            DriverVersion = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.DeviceDriver_Version) as DevicePropertyValueString)?.Value;

            DeviceResourceMemory = getMemoryResources(devInfo);
        }
Пример #2
0
        internal DeviceInfoPci(DeviceInfoSet devInfoSet, SP_DEVINFO_DATA devInfo) : base(devInfoSet, devInfo)
        {
            PciLinkSpeedCurrent = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.PciDevice_CurrentLinkSpeed) as DevicePropertyValueUInt32)?.Value ?? 0;
            PciLinkSpeedMax     = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.PciDevice_MaxLinkSpeed) as DevicePropertyValueUInt32)?.Value ?? 0;

            PciLinkWidthCurrent = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.PciDevice_CurrentLinkWidth) as DevicePropertyValueUInt32)?.Value ?? 0;
            PciLinkWidthMax     = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.PciDevice_MaxLinkWidth) as DevicePropertyValueUInt32)?.Value ?? 0;

            PciBarTypes = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.PciDevice_BarTypes) as DevicePropertyValueUInt32)?.Value ?? 0;
        }
Пример #3
0
        internal static DeviceInfo Create(DeviceInfoSet devInfoSet, SP_DEVINFO_DATA devInfo)
        {
            var busType = (devInfoSet.GetProperty(devInfo, DevicePropertyKey.Device_BusTypeGuid) as DevicePropertyValueGuid)?.Value;

            if (busType == DeviceBusType.Pci)
            {
                return(new DeviceInfoPci(devInfoSet, devInfo));
            }

            return(new DeviceInfo(devInfoSet, devInfo));
        }