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

Replaced magic numbers with enum values

This commit is contained in:
Darth Affe 2020-07-16 00:43:51 +02:00
parent 93eae1d859
commit 924fa40232

View File

@ -90,52 +90,45 @@ namespace RGB.NET.Devices.Asus
{ {
try try
{ {
IAsusRGBDevice rgbDevice = null; IAsusRGBDevice rgbDevice;
switch (device.Type) switch ((AsusDeviceType)device.Type)
{ {
case 0x00010000: //Motherboard case AsusDeviceType.MB_RGB:
rgbDevice = new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, WMIHelper.GetMainboardInfo()?.model ?? device.Name)); rgbDevice = new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, WMIHelper.GetMainboardInfo()?.model ?? device.Name));
break; break;
case 0x00011000: //Motherboard LED Strip case AsusDeviceType.MB_ADDRESABLE:
rgbDevice = new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.LedStripe, device), LedId.LedStripe1); rgbDevice = new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.LedStripe, device), LedId.LedStripe1);
break; break;
case 0x00020000: //VGA case AsusDeviceType.VGA_RGB:
rgbDevice = new AsusGraphicsCardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.GraphicsCard, device)); rgbDevice = new AsusGraphicsCardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.GraphicsCard, device));
break; break;
case 0x00040000: //Headset case AsusDeviceType.HEADSET_RGB:
rgbDevice = new AsusHeadsetRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Headset, device)); rgbDevice = new AsusHeadsetRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Headset, device));
break; break;
case 0x00070000: //DRAM case AsusDeviceType.DRAM_RGB:
rgbDevice = new AsusDramRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.DRAM, device)); rgbDevice = new AsusDramRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.DRAM, device));
break; break;
case 0x00080000: //Keyboard case AsusDeviceType.KEYBOARD_RGB:
case 0x00081000: //Notebook Keyboard case AsusDeviceType.NB_KB_RGB:
case 0x00081001: //Notebook Keyboard(4 - zone type) case AsusDeviceType.NB_KB_4ZONE_RGB:
rgbDevice = new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device, CultureInfo.CurrentCulture)); rgbDevice = new AsusKeyboardRGBDevice(new AsusKeyboardRGBDeviceInfo(device, CultureInfo.CurrentCulture));
break; break;
case 0x00090000: //Mouse case AsusDeviceType.MOUSE_RGB:
rgbDevice = new AsusMouseRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mouse, device)); rgbDevice = new AsusMouseRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mouse, device));
break; break;
case 0x00000000: //All default:
case 0x00012000: //All - In - One PC
case 0x00030000: //Display
case 0x00050000: //Microphone
case 0x00060000: //External HDD
case 0x00061000: //External BD Drive
case 0x000B0000: //Chassis
case 0x000C0000: //Projector
rgbDevice = new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Unknown, device), LedId.Custom1); rgbDevice = new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Unknown, device), LedId.Custom1);
break; break;
} }
if ((rgbDevice != null) && loadFilter.HasFlag(rgbDevice.DeviceInfo.DeviceType)) if (loadFilter.HasFlag(rgbDevice.DeviceInfo.DeviceType))
{ {
rgbDevice.Initialize(UpdateTrigger); rgbDevice.Initialize(UpdateTrigger);
devices.Add(rgbDevice); devices.Add(rgbDevice);