// ReSharper disable UnusedAutoPropertyAccessor.Global // ReSharper disable MemberCanBePrivate.Global // ReSharper disable UnusedMember.Global using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Drawing; using System.Linq; using CUE.NET.Devices.Generic; using CUE.NET.Devices.Headset.Enums; using CUE.NET.Effects; namespace CUE.NET.Devices.Headset { /// /// Represents the SDK for a corsair headset. /// public class CorsairHeadset : AbstractCueDevice, IEnumerable { #region Properties & Fields #region Indexer /// /// Gets the with the specified ID. /// /// The ID of the LED to get. /// The LED with the specified ID. public CorsairLed this[CorsairHeadsetLedId ledId] { get { CorsairLed led; return base.Leds.TryGetValue((int)ledId, out led) ? led : null; } } #endregion /// /// Gets specific information provided by CUE for the headset. /// public CorsairHeadsetDeviceInfo HeadsetDeviceInfo { get; } /// /// Gets a value indicating if the headset has an active effect to deal with or not. /// protected override bool HasEffect => false; /// /// Gets a read-only collection containing all LEDs of the headset. /// public new IEnumerable Leds => new ReadOnlyCollection(base.Leds.Values.ToList()); #endregion #region Constructors /// /// Initializes a new instance of the class. /// /// The specific information provided by CUE for the headset internal CorsairHeadset(CorsairHeadsetDeviceInfo info) : base(info) { this.HeadsetDeviceInfo = info; InitializeLeds(); } #endregion #region Methods protected override void ApplyEffect(IEffect effect) { //TODO DarthAffe 18.10.2015: How should brushes be applied to headsets? foreach (CorsairLed led in effect.LedList) led.Color = effect.EffectBrush.GetColorAtPoint(new RectangleF(0, 0, 2, 2), new PointF(1, 1)); } private void InitializeLeds() { GetLed((int)CorsairHeadsetLedId.LeftLogo); GetLed((int)CorsairHeadsetLedId.RightLogo); } #region IEnumerable /// /// Returns an enumerator that iterates over all LEDs of the headset. /// /// An enumerator for all LDS of the headset. public IEnumerator GetEnumerator() { return Leds.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } #endregion #endregion } }