using RGB.NET.Core;
using RGB.NET.Devices.Msi.Native;
namespace RGB.NET.Devices.Msi
{
///
///
/// Represents a MSI mainboard.
///
public class MsiMainboardRGBDevice : MsiRGBDevice
{
#region Constructors
///
///
/// Initializes a new instance of the class.
///
/// The specific information provided by MSI for the mainboard.
internal MsiMainboardRGBDevice(MsiRGBDeviceInfo info)
: base(info)
{ }
#endregion
#region Methods
///
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++)
{
//Hex3l: Should it be configurable in order to provide style access?
//Hex3l: Sets led style to "Steady" in order to have a solid color output therefore a controllable led color
//Hex3l: This is a string defined by the output of _MsiSDK.GetLedStyle, "Steady" should be always present
const string LED_STYLE = "Steady";
_MsiSDK.SetLedStyle(DeviceInfo.MsiDeviceType, j, LED_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\MSI\Mainboards\{DeviceInfo.Model.Replace(" ", string.Empty).ToUpper()}.xml"), null);
}
///
protected override object CreateLedCustomData(LedId ledId) => (int)ledId - (int)LedId.Mainboard1;
///
public override void SyncBack()
{ }
#endregion
}
}