// ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedAutoPropertyAccessor.Global // ReSharper disable UnusedMember.Global using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using CUE.NET.Devices.Generic; using CUE.NET.Devices.Generic.Enums; using CUE.NET.Devices.Mouse.Enums; using CUE.NET.Exceptions; using CUE.NET.Native; namespace CUE.NET.Devices.Mouse { /// /// Represents the SDK for a corsair mouse. /// public class CorsairMouse : AbstractCueDevice { #region Properties & Fields /// /// Gets specific information provided by CUE for the mouse. /// public CorsairMouseDeviceInfo MouseDeviceInfo { get; } #endregion #region Constructors /// /// Initializes a new instance of the class. /// /// The specific information provided by CUE for the mouse internal CorsairMouse(CorsairMouseDeviceInfo info) : base(info) { this.MouseDeviceInfo = info; } #endregion #region Methods /// /// Initializes the mouse. /// public override void Initialize() { // Glaive is a special flake that doesn't follow the default layout if (MouseDeviceInfo.Model == "GLAIVE RGB") { InitializeLed(CorsairMouseLedId.B1, new RectangleF(0, 0, 1, 1)); // Logo InitializeLed(CorsairMouseLedId.B2, new RectangleF(2, 0, 1, 1)); // Front InitializeLed(CorsairMouseLedId.B5, new RectangleF(3, 0, 1, 1)); // Sides return; } switch (MouseDeviceInfo.PhysicalLayout) { case CorsairPhysicalMouseLayout.Zones1: InitializeLed(CorsairMouseLedId.B1, new RectangleF(0, 0, 1, 1)); break; case CorsairPhysicalMouseLayout.Zones2: InitializeLed(CorsairMouseLedId.B1, new RectangleF(0, 0, 1, 1)); InitializeLed(CorsairMouseLedId.B2, new RectangleF(1, 0, 1, 1)); break; case CorsairPhysicalMouseLayout.Zones3: InitializeLed(CorsairMouseLedId.B1, new RectangleF(0, 0, 1, 1)); InitializeLed(CorsairMouseLedId.B2, new RectangleF(1, 0, 1, 1)); InitializeLed(CorsairMouseLedId.B3, new RectangleF(2, 0, 1, 1)); break; case CorsairPhysicalMouseLayout.Zones4: InitializeLed(CorsairMouseLedId.B1, new RectangleF(0, 0, 1, 1)); InitializeLed(CorsairMouseLedId.B2, new RectangleF(1, 0, 1, 1)); InitializeLed(CorsairMouseLedId.B3, new RectangleF(2, 0, 1, 1)); InitializeLed(CorsairMouseLedId.B4, new RectangleF(3, 0, 1, 1)); break; default: throw new WrapperException($"Can't initial mouse with layout '{MouseDeviceInfo.PhysicalLayout}'"); } base.Initialize(); } #endregion } }