mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Merge pull request #77 from DarthAffe/Fix/GetDevicesFilter
Improved device-filter in GetDevices; Fixed Unknown-DeviceType
This commit is contained in:
commit
ca1c0b364c
@ -13,11 +13,6 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a device where the type is not known or not present in the list.
|
||||
/// </summary>
|
||||
Unknown = -1,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a keyboard.
|
||||
/// </summary>
|
||||
@ -88,6 +83,11 @@ namespace RGB.NET.Core
|
||||
/// </summary>
|
||||
Cooler = 1 << 13,
|
||||
|
||||
/// <summary>
|
||||
/// Represents a device where the type is not known or not present in the list.
|
||||
/// </summary>
|
||||
Unknown = 1 << 31,
|
||||
|
||||
/// <summary>
|
||||
/// Represents all devices.
|
||||
/// </summary>
|
||||
|
||||
@ -250,7 +250,7 @@ namespace RGB.NET.Core
|
||||
/// <param name="deviceType">The <see cref="RGBDeviceType"/> of the devices to get.</param>
|
||||
/// <returns>a list of devices matching the specified <see cref="RGBDeviceType"/>.</returns>
|
||||
public IList<IRGBDevice> GetDevices(RGBDeviceType deviceType)
|
||||
=> new ReadOnlyCollection<IRGBDevice>(deviceType == RGBDeviceType.All ? _devices : _devices.Where(x => x.DeviceInfo.DeviceType == deviceType).ToList());
|
||||
=> new ReadOnlyCollection<IRGBDevice>(_devices.Where(d => deviceType.HasFlag(d.DeviceInfo.DeviceType)).ToList());
|
||||
|
||||
/// <summary>
|
||||
/// Registers the provided <see cref="IUpdateTrigger"/>.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user