Readded support for older CUE-SDKs

This commit is contained in:
DarthAffe committed 2023-07-23 19:49:30 +02:00
1 parent 56d77dee35
commit 6f91af9039
52 files changed
+4317

No files matched your search

@@ -0,0 +1,12 @@
using System.Collections.Generic;
using System.Linq;
namespace RGB.NET.Devices.CorsairLegacy;
internal static class DictionaryExtension
{
public static Dictionary<TValue, TKey> SwapKeyValue<TKey, TValue>(this Dictionary<TKey, TValue> dictionary)
where TKey : notnull
where TValue : notnull
=> dictionary.ToDictionary(x => x.Value, x => x.Key);
}
@@ -0,0 +1,18 @@
using RGB.NET.Core;
using RGB.NET.Devices.CorsairLegacy.Native;
namespace RGB.NET.Devices.CorsairLegacy;
internal static class NativeExtensions
{
internal static Rectangle ToRectangle(this _CorsairLedPosition position)
{
//HACK DarthAffe 08.07.2018: It seems like corsair introduced a bug here - it's always 0.
float width = position.width < 0.5f ? 10 : (float)position.width;
float height = position.height < 0.5f ? 10 : (float)position.height;
float posX = (float)position.left;
float posY = (float)position.top;
return new Rectangle(posX, posY, width, height);
}
}