using System.Diagnostics;
using RGB.NET.Core;
namespace RGB.NET.Devices.Logitech
{
///
///
/// Represents a Id of a on a .
///
[DebuggerDisplay("{" + nameof(LedId) + "}")]
public class LogitechLedId : ILedId
{
#region Properties & Fields
internal readonly LogitechLedIds LedId;
///
public IRGBDevice Device { get; }
///
public bool IsValid => LedId != LogitechLedIds.Invalid;
#endregion
#region Constructors
///
/// Initializes a new instance of the class.
///
/// The the belongs to.
/// The of the represented .
public LogitechLedId(IRGBDevice device, LogitechLedIds ledId)
{
this.Device = device;
this.LedId = ledId;
}
#endregion
#region Methods
///
/// Converts the Id of this to a human-readable string.
///
/// A string that contains the Id of this . For example "Enter".
public override string ToString()
{
return LedId.ToString();
}
///
/// Tests whether the specified object is a and is equivalent to this .
///
/// The object to test.
/// true if is a equivalent to this ; otherwise, false.
public override bool Equals(object obj)
{
LogitechLedId compareLedId = obj as LogitechLedId;
if (ReferenceEquals(compareLedId, null))
return false;
if (ReferenceEquals(this, compareLedId))
return true;
if (GetType() != compareLedId.GetType())
return false;
return compareLedId.LedId == LedId;
}
///
/// Returns a hash code for this .
///
/// An integer value that specifies the hash code for this .
public override int GetHashCode()
{
return LedId.GetHashCode();
}
#endregion
#region Operators
///
/// Returns a value that indicates whether two specified are equal.
///
/// The first to compare.
/// The second to compare.
/// true if and are equal; otherwise, false.
public static bool operator ==(LogitechLedId ledId1, LogitechLedId ledId2)
{
return ReferenceEquals(ledId1, null) ? ReferenceEquals(ledId2, null) : ledId1.Equals(ledId2);
}
///
/// Returns a value that indicates whether two specified are equal.
///
/// The first to compare.
/// The second to compare.
/// true if and are not equal; otherwise, false.
public static bool operator !=(LogitechLedId ledId1, LogitechLedId ledId2)
{
return !(ledId1 == ledId2);
}
#endregion
}
}