1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 01:58:30 +00:00

Merge pull request #226 from DarthAffe/SDK/ASUS

ASUS - Keep local arrays of lights in an attempt to fix crashes
This commit is contained in:
RobertBeekman 2021-09-27 19:57:18 +02:00 committed by GitHub
commit 02843705a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,8 @@ namespace RGB.NET.Devices.Asus
{
#region Properties & Fields
private readonly IAuraRgbLight[] _lights;
/// <summary>
/// The device to be updated.
/// </summary>
@ -30,6 +32,10 @@ namespace RGB.NET.Devices.Asus
: base(updateTrigger)
{
this.Device = device;
this._lights = new IAuraRgbLight[device.Lights.Count];
for (int i = 0; i < device.Lights.Count; i++)
_lights[i] = device.Lights[i];
}
#endregion
@ -59,7 +65,7 @@ namespace RGB.NET.Devices.Asus
}
else
{
IAuraRgbLight light = keyboard.Lights[id];
IAuraRgbLight light = _lights[id];
(_, byte r, byte g, byte b) = value.GetRGBBytes();
light.Red = r;
light.Green = g;
@ -72,7 +78,7 @@ namespace RGB.NET.Devices.Asus
foreach ((object key, Color value) in dataSet)
{
int index = (int)key;
IAuraRgbLight light = Device.Lights[index];
IAuraRgbLight light = _lights[index];
(_, byte r, byte g, byte b) = value.GetRGBBytes();
light.Red = r;