1
0
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:
DarthAffe 2019-06-16 17:30:07 +02:00 committed by GitHub
commit ca1c0b364c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

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>

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"/>.