Merge branch 'Development' into SDK/Corsair

This commit is contained in:
DarthAffe authored and GitHub committed 2020-10-04 12:52:41 +02:00
commit 75d748b5fe
173 files changed
+2941 -702

No files matched your search

@@ -6,11 +6,11 @@ using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
/// <inheritdoc />
/// <inheritdoc cref="CorsairRGBDevice{TDeviceInfo}" />
/// <summary>
/// Represents a corsair custom.
/// </summary>
public class CorsairCustomRGBDevice : CorsairRGBDevice<CorsairCustomRGBDeviceInfo>
public class CorsairCustomRGBDevice : CorsairRGBDevice<CorsairCustomRGBDeviceInfo>, IUnknownDevice
{
#region Properties & Fields
@@ -28,15 +28,16 @@ namespace RGB.NET.Devices.Corsair
/// <summary>
/// Internal constructor of managed <see cref="T:RGB.NET.Devices.Corsair.CorsairCustomRGBDeviceInfo" />.
/// </summary>
/// <param name="deviceIndex">The index of the <see cref="T:RGB.NET.Devices.Corsair.CorsairCustomRGBDevice" />.</param>
/// <param name="info">The info describing the the <see cref="T:RGB.NET.Devices.Corsair.CorsairCustomRGBDevice" />.</param>
/// <param name="nativeInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairDeviceInfo" />-struct</param>
/// <param name="channelDeviceInfo">The native <see cref="T:RGB.NET.Devices.Corsair.Native._CorsairChannelDeviceInfo"/> representing this device.</param>
/// <param name="referenceCorsairLed">The id of the first led of this device.</param>
/// <param name="modelCounter">A dictionary containing counters to create unique names for equal devices models.</param>
internal CorsairCustomRGBDeviceInfo(int deviceIndex, _CorsairDeviceInfo nativeInfo, _CorsairChannelDeviceInfo channelDeviceInfo,
internal CorsairCustomRGBDeviceInfo(CorsairRGBDeviceInfo info, _CorsairDeviceInfo nativeInfo,
_CorsairChannelDeviceInfo channelDeviceInfo,
CorsairLedId referenceCorsairLed, Dictionary<string, int> modelCounter)
: base(deviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo,
GetModelName(channelDeviceInfo.type), modelCounter)
: base(info.CorsairDeviceIndex, GetDeviceType(channelDeviceInfo.type), nativeInfo,
GetModelName(info, channelDeviceInfo), modelCounter)
{
this.ReferenceCorsairLed = referenceCorsairLed;
@@ -73,9 +74,9 @@ namespace RGB.NET.Devices.Corsair
}
}
private static string GetModelName(CorsairChannelDeviceType deviceType)
private static string GetModelName(IRGBDeviceInfo info, _CorsairChannelDeviceInfo channelDeviceInfo)
{
switch (deviceType)
switch (channelDeviceInfo.type)
{
case CorsairChannelDeviceType.Invalid:
return "Invalid";
@@ -93,7 +94,19 @@ namespace RGB.NET.Devices.Corsair
return "ML Fan";
case CorsairChannelDeviceType.Strip:
return "LED Strip";
// LS100 Led Strips are reported as one big strip if configured in monitor mode in iCUE, 138 LEDs for dual monitor, 84 for single
if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 138))
return "LS100 LED Strip (dual monitor)";
else if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 84))
return "LS100 LED Strip (single monitor)";
// Any other value means an "External LED Strip" in iCUE, these are reported per-strip, 15 for short strips, 27 for long
else if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 15))
return "LS100 LED Strip (short)";
else if ((info.Model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 27))
return "LS100 LED Strip (long)";
// Device model is "Commander Pro" for regular LED strips
else
return "LED Strip";
case CorsairChannelDeviceType.DAP:
return "DAP Fan";
@@ -105,7 +118,7 @@ namespace RGB.NET.Devices.Corsair
return "QL Fan";
default:
throw new ArgumentOutOfRangeException(nameof(deviceType), deviceType, null);
throw new ArgumentOutOfRangeException(nameof(channelDeviceInfo.type), channelDeviceInfo.type, null);
}
}