public PACSAMKey(byte[] header) : this() { BinaryParser parser = new BinaryParser(header, ByteEndianess.BigEndian); // Key Index Index = parser.ReadInt16(); // Type KeyType = (PACSAMKeyType)parser.ReadUInt8(); // Id Id = parser.ReadInt16(); // Version Version = parser.ReadUInt8(); // Attributes Attributes = (PACSAMKeyAttribute)parser.ReadUInt16(); // Name Name = parser.ReadString(MaxNameLength).Trim(); }
private static Object ReadIntegral(BinaryParser parser, TypeCode typeCode) { switch (typeCode) { case TypeCode.Byte: return parser.ReadByte(); case TypeCode.UInt16: return parser.ReadUInt16(); case TypeCode.UInt32: return parser.ReadUInt32(); case TypeCode.UInt64: return parser.ReadUInt64(); case TypeCode.SByte: return parser.ReadSByte(); case TypeCode.Int16: return parser.ReadInt16(); case TypeCode.Int32: return parser.ReadInt32(); case TypeCode.Int64: return parser.ReadInt64(); } return null; }