/// <summary> /// Gets the <see cref="APIOutputMode"/> associated with the specified ID <paramref name="value"/>. /// </summary> /// <param name="source"></param> /// <param name="value">ID value to retrieve <see cref="APIOutputMode"/>.</param> /// <returns>The <see cref="APIOutputMode"/> for the specified ID <paramref name="value"/>, /// <see cref="APIOutputMode.MODE_UNKNOWN"/> if it does not exist.</returns> public static APIOutputMode Get(this APIOutputMode source, byte value) { var values = Enum.GetValues(typeof(APIOutputMode)).OfType <APIOutputMode>(); if (values.Cast <byte>().Contains(value)) { return((APIOutputMode)value); } return(APIOutputMode.MODE_UNKNOWN); }
/// <summary> /// Gets the string representation of the API output mode. /// </summary> /// <param name="source"></param> /// <returns>String representation of the API output mode.</returns> public static string ToDisplayString(this APIOutputMode source) { return(HexUtils.ByteToHexString((byte)source) + ": " + lookupTable[source]); }
/// <summary> /// Gets the API output mode description. /// </summary> /// <param name="source"></param> /// <returns>API output mode description.</returns> public static string GetDescription(this APIOutputMode source) { return(lookupTable[source]); }
/// <summary> /// Gets the API output mode value. /// </summary> /// <param name="source"></param> /// <returns>API output mode value.</returns> public static byte GetValue(this APIOutputMode source) { return((byte)source); }