using System; using System.Collections.Generic; using System.Linq; using RGB.NET.Core; using RGB.NET.Devices.Logitech.Native; namespace RGB.NET.Devices.Logitech { /// /// /// Represents a logitech per-device-lightable device. /// public class LogitechPerDeviceRGBDevice : LogitechRGBDevice { #region Constructors /// /// /// Initializes a new instance of the class. /// /// The specific information provided by logitech for the per-device-lightable device internal LogitechPerDeviceRGBDevice(LogitechRGBDeviceInfo info) : base(info) { } #endregion #region Methods /// protected override void InitializeLayout() { base.InitializeLayout(); if (LedMapping.Count == 0) InitializeLed(LedId.Custom1, new Rectangle(0, 0, 10, 10)); } /// protected override object CreateLedCustomData(LedId ledId) => LogitechLedId.DEVICE; /// protected override void UpdateLeds(IEnumerable ledsToUpdate) { Led led = ledsToUpdate.FirstOrDefault(x => x.Color.A > 0); if (led == null) return; _LogitechGSDK.LogiLedSetTargetDevice(LogitechDeviceCaps.DeviceRGB); _LogitechGSDK.LogiLedSetLighting((int)Math.Round(led.Color.RPercent * 100), (int)Math.Round(led.Color.GPercent * 100), (int)Math.Round(led.Color.BPercent * 100)); } #endregion } }