Merge pull request #227 from DarthAffe/CodeIssues

Preparing for first major release
This commit is contained in:
DarthAffe authored and GitHub committed 2021-08-07 17:52:20 +02:00
commit 1bae7fd3de
241 files changed
+2168 -794

No files matched your search

@@ -14,6 +14,9 @@ namespace RGB.NET.Devices.Corsair
{
#region Properties & Fields
/// <summary>
/// Gets the mapping of <see cref="LedId"/> to <see cref="CorsairLedId"/> used to update the LEDs of this device.
/// </summary>
protected LedMapping<CorsairLedId> Mapping { get; }
#endregion
@@ -24,6 +27,8 @@ namespace RGB.NET.Devices.Corsair
/// Initializes a new instance of the <see cref="CorsairRGBDevice{TDeviceInfo}"/> class.
/// </summary>
/// <param name="info">The generic information provided by CUE for the device.</param>
/// <param name="mapping">The mapping <see cref="LedId"/> to <see cref="CorsairLedId"/> used to update the LEDs of this device.</param>
/// <param name="updateQueue">The queue used to update this device.</param>
protected CorsairRGBDevice(TDeviceInfo info, LedMapping<CorsairLedId> mapping, CorsairDeviceUpdateQueue updateQueue)
: base(info, updateQueue)
{
@@ -35,7 +40,10 @@ namespace RGB.NET.Devices.Corsair
#region Methods
void ICorsairRGBDevice.Initialize() => InitializeLayout();
/// <summary>
/// Initializes the LEDs of the device based on the data provided by the SDK.
/// </summary>
protected virtual void InitializeLayout()
{
_CorsairLedPositions? nativeLedPositions = (_CorsairLedPositions?)Marshal.PtrToStructure(_CUESDK.CorsairGetLedPositionsByDeviceIndex(DeviceInfo.CorsairDeviceIndex), typeof(_CorsairLedPositions));
+39 -8
View File
@@ -2,6 +2,9 @@
namespace RGB.NET.Devices.Corsair
{
/// <summary>
/// Contains mappings for <see cref="LedId"/> to <see cref="CorsairLedId"/>.
/// </summary>
public static class LedMappings
{
static LedMappings()
@@ -28,19 +31,44 @@ namespace RGB.NET.Devices.Corsair
Keyboard.Add(LedId.Custom101 + i, CorsairLedId.OemLed101 + i);
}
public static LedMapping<CorsairLedId> GraphicsCard = new();
public static LedMapping<CorsairLedId> HeadsetStand = new();
public static LedMapping<CorsairLedId> Mainboard = new();
public static LedMapping<CorsairLedId> Memory = new();
public static LedMapping<CorsairLedId> Mousepad = new();
/// <summary>
/// Gets the mapping for graphics cards.
/// </summary>
public static LedMapping<CorsairLedId> GraphicsCard { get; } = new();
public static LedMapping<CorsairLedId> Headset = new()
/// <summary>
/// Gets the mapping for headsets.
/// </summary>
public static LedMapping<CorsairLedId> HeadsetStand { get; } = new();
/// <summary>
/// Gets the mapping for mainboards.
/// </summary>
public static LedMapping<CorsairLedId> Mainboard { get; } = new();
/// <summary>
/// Gets the mapping for memory.
/// </summary>
public static LedMapping<CorsairLedId> Memory { get; } = new();
/// <summary>
/// Gets the mapping for mousepads.
/// </summary>
public static LedMapping<CorsairLedId> Mousepad { get; } = new();
/// <summary>
/// Gets the mapping for headsets.
/// </summary>
public static LedMapping<CorsairLedId> Headset { get; } = new()
{
{ LedId.Headset1, CorsairLedId.LeftLogo },
{ LedId.Headset2, CorsairLedId.RightLogo },
};
public static LedMapping<CorsairLedId> Mouse = new()
/// <summary>
/// Gets the mapping for mice.
/// </summary>
public static LedMapping<CorsairLedId> Mouse { get; } = new()
{
{ LedId.Mouse1, CorsairLedId.B1 },
{ LedId.Mouse2, CorsairLedId.B2 },
@@ -64,7 +92,10 @@ namespace RGB.NET.Devices.Corsair
{ LedId.Mouse20, CorsairLedId.B20 },
};
public static LedMapping<CorsairLedId> Keyboard = new()
/// <summary>
/// Gets the mapping for keyboards.
/// </summary>
public static LedMapping<CorsairLedId> Keyboard { get; } = new()
{
{ LedId.Invalid, CorsairLedId.Invalid },
{ LedId.Logo, CorsairLedId.Logo },