From 0813b8eeab59120387bacca986776517ee391b93 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Thu, 20 Dec 2018 14:46:01 +0100 Subject: [PATCH] Added basic model detection for asus graphic cards --- .../AsusGraphicsCardRGBDeviceInfo.cs | 2 +- RGB.NET.Devices.Asus/Helper/WMIHelper.cs | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs index bdc5977..ccf27c7 100644 --- a/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs +++ b/RGB.NET.Devices.Asus/GraphicsCard/AsusGraphicsCardRGBDeviceInfo.cs @@ -25,7 +25,7 @@ namespace RGB.NET.Devices.Asus /// The type of the . /// The handle of the . internal AsusGraphicsCardRGBDeviceInfo(RGBDeviceType deviceType, IntPtr handle) - : base(deviceType, handle) + : base(deviceType, handle, WMIHelper.GetGraphicsCardsInfo() ?? "Generic Asus-Device") { } #endregion diff --git a/RGB.NET.Devices.Asus/Helper/WMIHelper.cs b/RGB.NET.Devices.Asus/Helper/WMIHelper.cs index e35ad1b..0ea746e 100644 --- a/RGB.NET.Devices.Asus/Helper/WMIHelper.cs +++ b/RGB.NET.Devices.Asus/Helper/WMIHelper.cs @@ -8,8 +8,11 @@ namespace RGB.NET.Devices.Asus { #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 _graphicsCardInfo; #endregion @@ -27,6 +30,18 @@ namespace RGB.NET.Devices.Asus return _mainboardInfo; } + internal static string GetGraphicsCardsInfo() + { + if (_graphicsCardInfo == null) + foreach (ManagementBaseObject managementBaseObject in _graphicsCardSearcher.Get()) + { + _graphicsCardInfo = managementBaseObject["Name"]?.ToString(); + break; + } + + return _graphicsCardInfo; + } + #endregion } } @@ -40,6 +55,8 @@ namespace RGB.NET.Devices.Asus internal static (string manufacturer, string model)? GetMainboardInfo() => null; + internal static string GetGraphicsCardsInfo() => null; + #endregion } }