internal MMDevice(IMMDevice realDevice) { _RealDevice = realDevice; GetPropertyInformation(); Marshal.ThrowExceptionForHR(_RealDevice.GetId(out _id)); IMMEndpoint ep = _RealDevice as IMMEndpoint; Marshal.ThrowExceptionForHR(ep.GetDataFlow(out _dataFlow)); Marshal.ThrowExceptionForHR(_RealDevice.GetState(out _state)); if (_PropertyStore.Contains(PKEY.PKEY_DeviceInterface_FriendlyName)) { _friendlyName = (string)_PropertyStore[PKEY.PKEY_DeviceInterface_FriendlyName].Value; } if (_PropertyStore.Contains(PKEY.PKEY_DeviceInterface_Icon)) { var iconPath = (string)_PropertyStore[PKEY.PKEY_DeviceInterface_Icon].Value; _icon = DeviceIconHelper.GetIconByPath(iconPath); } if (_PropertyStore.Contains(PKEY.PKEY_DeviceInterface_RealName)) { var nameValue = _PropertyStore[PKEY.PKEY_DeviceInterface_RealName].Value; if (nameValue is string s) { _realName = s; } } }
internal MMDevice(IMMDevice realDevice) { _RealDevice = realDevice; GetPropertyInformation(); Marshal.ThrowExceptionForHR(_RealDevice.GetId(out _id)); IMMEndpoint ep = _RealDevice as IMMEndpoint; Marshal.ThrowExceptionForHR(ep.GetDataFlow(out _dataFlow)); Marshal.ThrowExceptionForHR(_RealDevice.GetState(out _state)); if (_PropertyStore.Contains(PKEY.PKEY_DeviceInterface_FriendlyName)) { _friendlyName = (string)_PropertyStore[PKEY.PKEY_DeviceInterface_FriendlyName].Value; } }