mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +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:
commit
02843705a8
@ -12,6 +12,8 @@ namespace RGB.NET.Devices.Asus
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
private readonly IAuraRgbLight[] _lights;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The device to be updated.
|
/// The device to be updated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -30,6 +32,10 @@ namespace RGB.NET.Devices.Asus
|
|||||||
: base(updateTrigger)
|
: base(updateTrigger)
|
||||||
{
|
{
|
||||||
this.Device = device;
|
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
|
#endregion
|
||||||
@ -59,7 +65,7 @@ namespace RGB.NET.Devices.Asus
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IAuraRgbLight light = keyboard.Lights[id];
|
IAuraRgbLight light = _lights[id];
|
||||||
(_, byte r, byte g, byte b) = value.GetRGBBytes();
|
(_, byte r, byte g, byte b) = value.GetRGBBytes();
|
||||||
light.Red = r;
|
light.Red = r;
|
||||||
light.Green = g;
|
light.Green = g;
|
||||||
@ -72,7 +78,7 @@ namespace RGB.NET.Devices.Asus
|
|||||||
foreach ((object key, Color value) in dataSet)
|
foreach ((object key, Color value) in dataSet)
|
||||||
{
|
{
|
||||||
int index = (int)key;
|
int index = (int)key;
|
||||||
IAuraRgbLight light = Device.Lights[index];
|
IAuraRgbLight light = _lights[index];
|
||||||
|
|
||||||
(_, byte r, byte g, byte b) = value.GetRGBBytes();
|
(_, byte r, byte g, byte b) = value.GetRGBBytes();
|
||||||
light.Red = r;
|
light.Red = r;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user