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

Added basic model detection for asus graphic cards

This commit is contained in:
Darth Affe 2018-12-20 14:46:01 +01:00
parent 1cf0f692fd
commit 0813b8eeab
2 changed files with 19 additions and 2 deletions

View File

@ -25,7 +25,7 @@ namespace RGB.NET.Devices.Asus
/// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param> /// <param name="deviceType">The type of the <see cref="IRGBDevice"/>.</param>
/// <param name="handle">The handle of the <see cref="IRGBDevice"/>.</param> /// <param name="handle">The handle of the <see cref="IRGBDevice"/>.</param>
internal AsusGraphicsCardRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle) internal AsusGraphicsCardRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle)
: base(deviceType, handle) : base(deviceType, handle, WMIHelper.GetGraphicsCardsInfo() ?? "Generic Asus-Device")
{ } { }
#endregion #endregion

View File

@ -8,8 +8,11 @@ namespace RGB.NET.Devices.Asus
{ {
#region Properties & Fields #region Properties & Fields
private static ManagementObjectSearcher _mainboardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT * FROM Win32_BaseBoard"); private static ManagementObjectSearcher _mainboardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Manufacturer,Product FROM Win32_BaseBoard");
private static ManagementObjectSearcher _graphicsCardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Name FROM Win32_VideoController");
private static (string manufacturer, string model)? _mainboardInfo; private static (string manufacturer, string model)? _mainboardInfo;
private static string _graphicsCardInfo;
#endregion #endregion
@ -27,6 +30,18 @@ namespace RGB.NET.Devices.Asus
return _mainboardInfo; return _mainboardInfo;
} }
internal static string GetGraphicsCardsInfo()
{
if (_graphicsCardInfo == null)
foreach (ManagementBaseObject managementBaseObject in _graphicsCardSearcher.Get())
{
_graphicsCardInfo = managementBaseObject["Name"]?.ToString();
break;
}
return _graphicsCardInfo;
}
#endregion #endregion
} }
} }
@ -40,6 +55,8 @@ namespace RGB.NET.Devices.Asus
internal static (string manufacturer, string model)? GetMainboardInfo() => null; internal static (string manufacturer, string model)? GetMainboardInfo() => null;
internal static string GetGraphicsCardsInfo() => null;
#endregion #endregion
} }
} }