Merge pull request #77 from DarthAffe/Fix/GetDevicesFilter

Improved device-filter in GetDevices; Fixed Unknown-DeviceType
This commit is contained in:
DarthAffe authored and GitHub committed 2019-06-16 17:30:07 +02:00
commit ca1c0b364c
2 files changed
+6 -6

No files matched your search

+5 -5
View File
@@ -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>
+1 -1
View File
@@ -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"/>.