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

Added (for testing) workaround for asus devices

This commit is contained in:
Darth Affe 2021-04-05 14:54:00 +02:00
parent eb3b91d8d8
commit 313661a532

View File

@ -23,6 +23,7 @@ namespace RGB.NET.Devices.Asus
public static AsusDeviceProvider Instance => _instance ?? new AsusDeviceProvider();
private IAuraSdk2? _sdk;
private IAuraSyncDeviceCollection? _devices; //HACK DarthAffe 05.04.2021: Due to some researches this might fix the access violation in the asus-sdk
#endregion
@ -52,8 +53,10 @@ namespace RGB.NET.Devices.Asus
{
if (_sdk == null) yield break;
foreach (IAuraSyncDevice device in _sdk.Enumerate(0))
_devices = _sdk.Enumerate(0);
for (int i = 0; i < _devices.Count; i++)
{
IAuraSyncDevice device = _devices[i];
yield return (AsusDeviceType)device.Type switch
{
AsusDeviceType.MB_RGB => new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, WMIHelper.GetMainboardInfo()?.model ?? device.Name), GetUpdateTrigger()),
@ -78,6 +81,7 @@ namespace RGB.NET.Devices.Asus
try { _sdk?.ReleaseControl(0); }
catch { /* at least we tried */ }
_devices = null;
_sdk = null;
}