internal Device(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index) { if (deviceClass == null) { throw new ArgumentNullException(nameof(deviceClass)); } if (deviceInfoData == null) { throw new ArgumentNullException(nameof(deviceInfoData)); } DeviceClass = deviceClass; DeviceInfoData = deviceInfoData; Path = path; // may be null Index = index; _class = new Lazy <string>(GetClass); _classGuid = new Lazy <string>(GetClassGuid); _description = new Lazy <string>(GetDescription); _friendlyName = new Lazy <string>(GetFriendlyName); _capabilities = new Lazy <DeviceCapabilities>(GetCapabilities); _isUsb = new Lazy <bool>(GetIsUsb); _parent = new Lazy <Device>(GetParent); _removableDevices = new Lazy <DeviceCollection>(GetRemovableDevices); }
internal Volume(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index, ILogger logger) : base(deviceClass, deviceInfoData, path, index, logger) { _volumeName = new Lazy <string>(GetVolumeName); _logicalDrive = new Lazy <string>(GetLogicalDrive); _disks = new Lazy <DiskCollection>(GetDisks); _diskNumbers = new Lazy <int[]>(GetDiskNumbers); }
private Device GetParent() { uint parentDevInst = 0; int hr = Native.CM_Get_Parent(ref parentDevInst, DeviceInfoData.devInst, 0); if (hr == 0) { Native.SP_DEVINFO_DATA info = DeviceClass.GetInfo(parentDevInst); return(new Device(DeviceClass, info, null, -1)); } return(null); }
internal Device(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index) { if (deviceClass == null) { throw new ArgumentNullException("deviceClass"); } if (deviceInfoData == null) { throw new ArgumentNullException("deviceInfoData"); } _deviceClass = deviceClass; _path = path; // may be null _deviceInfoData = deviceInfoData; _index = index; }
private DeviceCapabilities GetCapabilities() { return((DeviceCapabilities)DeviceClass.GetProperty(DeviceInfoData, Native.SPDRP_CAPABILITIES, 0)); }
private string GetFriendlyName() { return(DeviceClass.GetProperty(DeviceInfoData, Native.SPDRP_FRIENDLYNAME, null)); }
private string GetDescription() { return(DeviceClass.GetProperty(DeviceInfoData, Native.SPDRP_DEVICEDESC, null)); }
private string GetClassGuid() { return(DeviceClass.GetProperty(DeviceInfoData, Native.SPDRP_CLASSGUID, null)); }
internal Disk(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index, ILogger logger) : base(deviceClass, deviceInfoData, path, index, logger) { _diskNumber = new Lazy <int>(GetDiskNumber); }
internal virtual Device CreateDevice(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index) { return(new Device(deviceClass, deviceInfoData, path, index)); }
internal Volume(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index) : base(deviceClass, deviceInfoData, path, index) { }
internal override Device CreateDevice(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index) { return(new Volume(deviceClass, deviceInfoData, path, index)); }