namespace RGB.NET.Devices.Novation { /// /// Offers some extensions and helper-methods for NovationLedIds related things. /// public static class NovationLedIdsExtension { #region Methods /// /// Gets the status-flag associated with the id. /// /// The whose status-flag should be determinated. /// The status-flag of the . public static int GetStatus(this NovationLedIds ledId) => ((int)ledId & 0xFF00) >> 8; /// /// Gets the id associated with the id. /// /// The whose idshould be determinated. /// The id of the . public static int GetId(this NovationLedIds ledId) => (int)ledId & 0x00FF; /// /// Tests if the given is a grid-button. /// /// the to test. /// true if is a grid-button; otherwise, false. public static bool IsGrid(this NovationLedIds ledId) => (ledId.GetStatus() == 0x90) && ((ledId.GetId() / 0x10) < 0x08) && ((ledId.GetId() % 0x10) < 0x08); /// /// Tests if the given is a scene-button. /// /// the to test. /// true if is a scene-button; otherwise, false. public static bool IsScene(this NovationLedIds ledId) => (ledId.GetStatus() == 0x90) && ((ledId.GetId() / 0x10) < 0x08) && ((ledId.GetId() % 0x10) == 0x09); /// /// Tests if the given is custom-button. /// /// the to test. /// true if is a custom-button; otherwise, false. public static bool IsCustom(this NovationLedIds ledId) => (ledId.GetStatus() == 0xB0) && ((ledId.GetId() / 0x10) == 0x06) && ((ledId.GetId() % 0x10) > 0x07); #endregion } }