private int ReadId() { var length = _reader.ReadUint(); var header = new Header(); header.Deserialize(_reader); var isError = header.Code >= CommandE.ErrorMin && header.Code < CommandE.ErrorMax; if (isError) { var errorMessage = ReadErrorMessage(); _reader.ReadRawBytes((int)length); throw new ResponseErrorException(header.SyncId, errorMessage); } return(header.SyncId); }
public void Deserialize(MessagePackReader reader) { var dictionaryLength = reader.ReadDictionaryLength(); for (var i = 0; i < dictionaryLength; i++) { var key = reader.ReadUint(); switch (key) { case IPROTO_REQUEST_TYPE_KEY: Code = (CommandE)reader.ReadUint(); break; case IPROTO_SYNC_KEY: SyncId = (int)reader.ReadUint(); break; case IPROTO_SCHEMA_VERSION_KEY: SchemaVersion = (int)reader.ReadUint(); break; } } }
private static void SniffBytes(Stream stream) { var reader = new MessagePackReader(new MessagePackStreamBuffer(stream)); var length = reader.ReadUint(); var bytes = new byte[length]; stream.Read(bytes); var stringBuilder = new StringBuilder(); for (var i = 0; i < length; i++) { stringBuilder.Append($"{bytes[i]}, "); } var result = $"[{stringBuilder}]"; }
public override uint Deserialize(MessagePackReader reader) { return(reader.ReadUint()); }