Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
 private DeviceCapabilities GetCapabilities()
 {
     return((DeviceCapabilities)DeviceClass.GetProperty(DeviceInfoData, Native.SPDRP_CAPABILITIES, 0));
 }
Exemplo n.º 6
0
 private string GetFriendlyName()
 {
     return(DeviceClass.GetProperty(DeviceInfoData, Native.SPDRP_FRIENDLYNAME, null));
 }
Exemplo n.º 7
0
 private string GetDescription()
 {
     return(DeviceClass.GetProperty(DeviceInfoData, Native.SPDRP_DEVICEDESC, null));
 }
Exemplo n.º 8
0
 private string GetClassGuid()
 {
     return(DeviceClass.GetProperty(DeviceInfoData, Native.SPDRP_CLASSGUID, null));
 }
Exemplo n.º 9
0
 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);
 }
Exemplo n.º 10
0
 internal virtual Device CreateDevice(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index)
 {
     return(new Device(deviceClass, deviceInfoData, path, index));
 }
Exemplo n.º 11
0
 internal Volume(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index)
     : base(deviceClass, deviceInfoData, path, index)
 {
 }
Exemplo n.º 12
0
 internal override Device CreateDevice(DeviceClass deviceClass, Native.SP_DEVINFO_DATA deviceInfoData, string path, int index)
 {
     return(new Volume(deviceClass, deviceInfoData, path, index));
 }