mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 01:58:30 +00:00
Adds support to MSI_MB device (motherboard)
This commit is contained in:
parent
d35b67a38c
commit
b92f121379
68
RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs
Normal file
68
RGB.NET.Devices.Msi/Mainboard/MsiMainboardRGBDevice.cs
Normal file
@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using RGB.NET.Core;
|
||||
using RGB.NET.Devices.Msi.Native;
|
||||
using RGB.NET.Devices.Msi.Exceptions;
|
||||
|
||||
namespace RGB.NET.Devices.Msi
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Represents a Msi mainboard.
|
||||
/// </summary>
|
||||
public class MsiMainboardRGBDevice : MsiRGBDevice<MsiRGBDeviceInfo>
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="T:RGB.NET.Devices.Msi.MsiMainboardRGBDevice" /> class.
|
||||
/// </summary>
|
||||
/// <param name="info">The specific information provided by Asus for the mainboard.</param>
|
||||
internal MsiMainboardRGBDevice(MsiRGBDeviceInfo info)
|
||||
: base(info)
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void InitializeLayout()
|
||||
{
|
||||
// Should errors be handled?
|
||||
_MsiSDK.GetDeviceInfo(out string[] deviceTypes, out int[] ledCounts);
|
||||
|
||||
for (int i = 0; i < deviceTypes.Length; i++)
|
||||
{
|
||||
// DeviceInfo.MsiDeviceType = "MSI_MB"
|
||||
if (deviceTypes[i].Equals(DeviceInfo.MsiDeviceType))
|
||||
{
|
||||
for (int j = 0; j < ledCounts[i]; j++)
|
||||
{
|
||||
// Should it be configurable in order to provide style access?
|
||||
// Sets led style to "Steady" in order to have a solid color output therefore a controllable led color
|
||||
// This is a string defined by the output of _MsiSDK.GetLedStyle, "Steady" should be always present
|
||||
string style = "Steady";
|
||||
|
||||
_MsiSDK.SetLedStyle(DeviceInfo.MsiDeviceType, j, style);
|
||||
InitializeLed(LedId.Mainboard1 + j, new Rectangle(j * 40, 0, 40, 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO DarthAffe 07.10.2017: We don't know the model, how to save layouts and images?
|
||||
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Asus\Mainboards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mainboard1;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void SyncBack()
|
||||
{ }
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -103,6 +103,16 @@ namespace RGB.NET.Devices.Msi
|
||||
try
|
||||
{
|
||||
//TODO DarthAffe 11.11.2017: What is this deviceType? Find someone to try that out
|
||||
|
||||
// MSI_MB provide access to the motherboard "leds" where a led must be intended as a led header (JRGB, JRAINBOW etc..) (Tested on MSI X570 Unify)
|
||||
if (deviceTypes[i].Equals("MSI_MB"))
|
||||
{
|
||||
IMsiRGBDevice motherboard = new MsiMainboardRGBDevice(new MsiRGBDeviceInfo(RGBDeviceType.Mainboard, deviceTypes[i], "Msi", "Motherboard"));
|
||||
motherboard.Initialize();
|
||||
devices.Add(motherboard);
|
||||
}
|
||||
|
||||
// Other devices?
|
||||
}
|
||||
catch { if (throwExceptions) throw; }
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user