namespace Common.Hardware.SIRT.Parameters { public class PAMStatus { private readonly byte[] bits; public PAMStatus(byte _byte) => this.bits = _byte.GetBitsLE(); public bool CMD_UNKNOWN => this.bits[0] == 1; public bool WRONG_AUTH => this.bits[1] == 1; public bool EXPIRED_AUTH => this.bits[2] == 1; public bool MIXED_TYPES => this.bits[3] == 1; public bool OUT_OF_RANGE => this.bits[4] == 1; public override string ToString() { if (this.bits.GetByteLE() == 0) { return nameof(OK); } if (this.OUT_OF_RANGE) { return nameof(this.OUT_OF_RANGE); } else if (this.MIXED_TYPES) { return nameof(this.MIXED_TYPES); } else if (this.CMD_UNKNOWN) { return nameof(this.CMD_UNKNOWN); } else if (this.EXPIRED_AUTH) { return nameof(this.EXPIRED_AUTH); } else if (this.WRONG_AUTH) { return nameof(this.WRONG_AUTH); } else { return string.Join(string.Empty, this.bits); } } public static byte OK = 0; public static byte EXPIREDAUTH = 4; public static implicit operator byte(PAMStatus status) => status?.bits?.GetByteLE() ?? 0xFF; public static implicit operator string(PAMStatus status) => status?.ToString(); } }