mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-10 20:46:24 +00:00
Refactored LedIds
Everything is now based on the same ids for all devices
This commit is contained in:
1 parent
200e471e4d
commit
c5a1825f50
80 files changed
+2923
-3657
No files matched your search
@@ -1,6 +1,7 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Core.Exceptions;
|
||||
|
||||
@@ -33,31 +34,40 @@ namespace RGB.NET.Devices.Corsair
|
||||
switch (DeviceInfo.PhysicalLayout)
|
||||
{
|
||||
case CorsairPhysicalMouseLayout.Zones1:
|
||||
InitializeLed(new CorsairLedId(this, CorsairLedIds.B1), new Rectangle(0, 0, 10, 10));
|
||||
InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10));
|
||||
break;
|
||||
case CorsairPhysicalMouseLayout.Zones2:
|
||||
InitializeLed(new CorsairLedId(this, CorsairLedIds.B1), new Rectangle(0, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(this, CorsairLedIds.B2), new Rectangle(10, 0, 10, 10));
|
||||
InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10));
|
||||
InitializeLed(LedId.Mouse2, new Rectangle(10, 0, 10, 10));
|
||||
break;
|
||||
case CorsairPhysicalMouseLayout.Zones3:
|
||||
InitializeLed(new CorsairLedId(this, CorsairLedIds.B1), new Rectangle(0, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(this, CorsairLedIds.B2), new Rectangle(10, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(this, CorsairLedIds.B3), new Rectangle(20, 0, 10, 10));
|
||||
InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10));
|
||||
InitializeLed(LedId.Mouse2, new Rectangle(10, 0, 10, 10));
|
||||
InitializeLed(LedId.Mouse3, new Rectangle(20, 0, 10, 10));
|
||||
break;
|
||||
case CorsairPhysicalMouseLayout.Zones4:
|
||||
InitializeLed(new CorsairLedId(this, CorsairLedIds.B1), new Rectangle(0, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(this, CorsairLedIds.B2), new Rectangle(10, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(this, CorsairLedIds.B3), new Rectangle(20, 0, 10, 10));
|
||||
InitializeLed(new CorsairLedId(this, CorsairLedIds.B4), new Rectangle(30, 0, 10, 10));
|
||||
InitializeLed(LedId.Mouse1, new Rectangle(0, 0, 10, 10));
|
||||
InitializeLed(LedId.Mouse2, new Rectangle(10, 0, 10, 10));
|
||||
InitializeLed(LedId.Mouse3, new Rectangle(20, 0, 10, 10));
|
||||
InitializeLed(LedId.Mouse4, new Rectangle(30, 0, 10, 10));
|
||||
break;
|
||||
default:
|
||||
throw new RGBDeviceException($"Can't initial mouse with layout '{DeviceInfo.PhysicalLayout}'");
|
||||
throw new RGBDeviceException($"Can't initialize mouse with layout '{DeviceInfo.PhysicalLayout}'");
|
||||
}
|
||||
|
||||
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Mice\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"),
|
||||
null, PathHelper.GetAbsolutePath(@"Images\Corsair\Mice"));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object CreateLedCustomData(LedId ledId)
|
||||
{
|
||||
if (string.Equals(DeviceInfo.Model, "GLAIVE RGB", StringComparison.OrdinalIgnoreCase))
|
||||
return MouseIdMapping.GLAIVE.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid;
|
||||
else
|
||||
return MouseIdMapping.DEFAULT.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace RGB.NET.Devices.Corsair
|
||||
{
|
||||
internal static class MouseIdMapping
|
||||
{
|
||||
internal static readonly Dictionary<LedId, CorsairLedId> DEFAULT = new Dictionary<LedId, CorsairLedId>
|
||||
{
|
||||
{ LedId.Mouse1, CorsairLedId.B1 },
|
||||
{ LedId.Mouse2, CorsairLedId.B2 },
|
||||
{ LedId.Mouse3, CorsairLedId.B3 },
|
||||
{ LedId.Mouse4, CorsairLedId.B4 },
|
||||
{ LedId.Mouse5, CorsairLedId.B5 },
|
||||
{ LedId.Mouse6, CorsairLedId.B6 },
|
||||
};
|
||||
|
||||
internal static readonly Dictionary<LedId, CorsairLedId> GLAIVE = new Dictionary<LedId, CorsairLedId>
|
||||
{
|
||||
{ LedId.Mouse1, CorsairLedId.B1 },
|
||||
{ LedId.Mouse2, CorsairLedId.B2 },
|
||||
{ LedId.Mouse3, CorsairLedId.B5 },
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user