using System; namespace ArchestrAServices.Contract; public struct ASBStatusElement { public ASBStatusType statusType; public ushort statusValue; public ASBStatus Status { get { byte b = 0; byte[] array = null; if (statusValue == 0) { b = 1; array = new byte[b]; array[0] = (byte)(((byte)statusType & 0x7F) | 0x80); } else { b = 3; array = new byte[b]; array[0] = (byte)((byte)statusType & 0x7F); byte[] array2 = new byte[2]; array2 = BitConverter.GetBytes(statusValue); array[1] = array2[0]; array[2] = array2[1]; } return new ASBStatus { Count = b, Payload = array }; } } public ASBStatusElement(ASBStatus singleStatus) { if (singleStatus.Payload == null || singleStatus.Payload.Length < 1) { throw new IndexOutOfRangeException("ASBStatus payload contained no data in ASBStatusElement constructor"); } if ((singleStatus.Payload[0] & 0x80) != 0) { statusType = (ASBStatusType)(singleStatus.Payload[0] & 0x7F); statusValue = 0; return; } if (singleStatus.Payload.Length < 3) { throw new IndexOutOfRangeException("ASBStatus payload contained insufficient data in ASBStatusElement constructor"); } statusType = (ASBStatusType)singleStatus.Payload[0]; statusValue = BitConverter.ToUInt16(singleStatus.Payload, 1); } }