1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 17:48:31 +00:00

make wootingcolor readonly, use int for array index

This commit is contained in:
Diogo Trindade 2025-06-18 19:31:00 +01:00
parent a96b994e61
commit 34b04523de
No known key found for this signature in database
GPG Key ID: 4B5B48393B9F875F
2 changed files with 7 additions and 8 deletions

View File

@ -66,7 +66,7 @@ public sealed class WootingGrpcDeviceProvider : AbstractRGBDeviceProvider
_client = new RgbSdkService.RgbSdkServiceClient(_channel);
}
/// <inheritdoc />
/// <inheritdoc />
protected override IEnumerable<IRGBDevice> LoadDevices()
{
ArgumentNullException.ThrowIfNull(_client, nameof(_client));

View File

@ -48,7 +48,7 @@ public sealed class WootingGrpcUpdateQueue : UpdateQueue
foreach ((object key, Color color) in dataSet)
{
(int row, int column) = ((int, int))key;
long index = (WootingLedMappings.COLUMNS * row) + column;
int index = (WootingLedMappings.COLUMNS * row) + column;
_colors[index] = new WootingColor(color.GetR(), color.GetG(), color.GetB());
}
@ -79,12 +79,12 @@ public sealed class WootingGrpcUpdateQueue : UpdateQueue
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
internal struct WootingColor
internal readonly struct WootingColor
{
public byte r;
public byte g;
public byte b;
public byte a;
public readonly byte r;
public readonly byte g;
public readonly byte b;
public readonly byte a;
public WootingColor(byte r, byte g, byte b)
{
@ -94,4 +94,3 @@ internal struct WootingColor
this.a = 0; // Alpha is not used in Wooting devices
}
}