mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Update AsusDeviceProvider.cs
This commit is contained in:
parent
3dc4f45f66
commit
df2f5620ee
@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Reflection.Metadata;
|
|
||||||
using AuraServiceLib;
|
using AuraServiceLib;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
|
|
||||||
@ -58,46 +55,16 @@ public class AsusDeviceProvider : AbstractRGBDeviceProvider
|
|||||||
|
|
||||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
protected override IEnumerable<IRGBDevice> LoadDevices()
|
||||||
{
|
{
|
||||||
if (_sdk == null) yield break;
|
if (_sdk == null) {
|
||||||
|
|
||||||
_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()),
|
|
||||||
AsusDeviceType.MB_ADDRESABLE => new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.LedStripe, device), LedId.LedStripe1, GetUpdateTrigger()),
|
|
||||||
AsusDeviceType.VGA_RGB => new AsusGraphicsCardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.GraphicsCard, device), GetUpdateTrigger()),
|
|
||||||
AsusDeviceType.HEADSET_RGB => new AsusHeadsetRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Headset, device), GetUpdateTrigger()),
|
|
||||||
AsusDeviceType.DRAM_RGB => new AsusDramRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.DRAM, device), GetUpdateTrigger()),
|
|
||||||
AsusDeviceType.KEYBOARD_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), LedMappings.KeyboardMapping, GetUpdateTrigger()),
|
|
||||||
AsusDeviceType.NB_KB_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), LedMappings.KeyboardMapping, GetUpdateTrigger()),
|
|
||||||
AsusDeviceType.NB_KB_4ZONE_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), null, GetUpdateTrigger()),
|
|
||||||
AsusDeviceType.MOUSE_RGB => new AsusMouseRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mouse, device), GetUpdateTrigger()),
|
|
||||||
_ => new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Unknown, device), LedId.Custom1, GetUpdateTrigger())
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
protected override IEnumerable<IRGBDevice> LoadDevices()
|
|
||||||
{
|
|
||||||
if (_sdk == null) {
|
|
||||||
throw new InvalidOperationException($"Asus Library not yet loaded.");
|
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var enviroment = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName;
|
|
||||||
var filePath = $"{enviroment}/ASUSDEBUG.txt";
|
|
||||||
var content = "";
|
|
||||||
|
|
||||||
_devices = _sdk.Enumerate(0);
|
_devices = _sdk.Enumerate(0);
|
||||||
for (int i = 0; i < _devices.Count; i++)
|
for (int i = 0; i < _devices.Count; i++)
|
||||||
{
|
{
|
||||||
IAuraSyncDevice device = _devices[i];
|
IAuraSyncDevice device = _devices[i];
|
||||||
|
|
||||||
content += $"Name: {device.Name} Type: {device.Type} Type Hex: {device.Type:X} LEDs: {device.Lights.Count} \n\n";
|
|
||||||
|
|
||||||
yield return (AsusDeviceType)device.Type switch
|
yield return (AsusDeviceType)device.Type switch
|
||||||
{
|
{
|
||||||
AsusDeviceType.MB_RGB => new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, WMIHelper.GetMainboardInfo()?.model ?? device.Name), GetUpdateTrigger()),
|
AsusDeviceType.MB_RGB => new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, WMIHelper.GetMainboardInfo()?.model ?? device.Name), GetUpdateTrigger()),
|
||||||
@ -110,13 +77,10 @@ public class AsusDeviceProvider : AbstractRGBDeviceProvider
|
|||||||
AsusDeviceType.NB_KB_4ZONE_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), null, GetUpdateTrigger()),
|
AsusDeviceType.NB_KB_4ZONE_RGB => new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device), null, GetUpdateTrigger()),
|
||||||
AsusDeviceType.MOUSE_RGB => new AsusMouseRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mouse, device), GetUpdateTrigger()),
|
AsusDeviceType.MOUSE_RGB => new AsusMouseRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mouse, device), GetUpdateTrigger()),
|
||||||
AsusDeviceType.TERMINAL_RGB => new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.LedController, device), LedId.Custom1, GetUpdateTrigger()),
|
AsusDeviceType.TERMINAL_RGB => new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.LedController, device), LedId.Custom1, GetUpdateTrigger()),
|
||||||
_ => new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Unknown, device), LedId.Custom1, GetUpdateTrigger())
|
_ => new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Unknown, device), LedId.Unknown1, GetUpdateTrigger())
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
System.IO.File.WriteAllText(filePath, content);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user