// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable UnusedMember.Global
using System.Collections.Generic;
using RGB.NET.Core;
namespace RGB.NET.Devices.Corsair
{
///
///
/// Represents a corsair custom.
///
public class CorsairCustomRGBDevice : CorsairRGBDevice
{
#region Properties & Fields
private readonly Dictionary _idMapping = new Dictionary();
#endregion
#region Constructors
///
///
/// Initializes a new instance of the class.
///
/// The specific information provided by CUE for the custom-device.
internal CorsairCustomRGBDevice(CorsairCustomRGBDeviceInfo info)
: base(info)
{ }
#endregion
#region Methods
///
protected override void InitializeLayout()
{
LedId referenceId = (DeviceInfo.DeviceType == RGBDeviceType.LedStripe ? LedId.LedStripe1 : (DeviceInfo.DeviceType == RGBDeviceType.Fan ? LedId.Fan1 : LedId.Custom1));
for (int i = 0; i < DeviceInfo.LedCount; i++)
{
LedId ledId = referenceId + i;
_idMapping.Add(ledId, DeviceInfo.ReferenceCorsairLed + i);
InitializeLed(ledId, new Rectangle(i * 10, 0, 10, 10));
}
string model = DeviceInfo.Model.Replace(" ", string.Empty).ToUpper();
ApplyLayoutFromFile(PathHelper.GetAbsolutePath($@"Layouts\Corsair\Customs\{model}.xml"), null);
}
///
protected override object CreateLedCustomData(LedId ledId) => _idMapping.TryGetValue(ledId, out CorsairLedId id) ? id : CorsairLedId.Invalid;
#endregion
}
}