public RequestId Read(IMsgPackReader reader) { var type = reader.ReadDataType(); if (type != DataTypes.UInt64) { throw ExceptionHelper.UnexpectedDataType(DataTypes.UInt64, type); } var allbytes = reader.ReadBytes(8); var ulongValue = new ULongBinary(allbytes); return(new RequestId(ulongValue.value)); }
public void Write(RequestId value, IMsgPackWriter writer) { writer.Write(DataTypes.UInt64); var binary = new ULongBinary(value.Value); byte[] bytes; if (BitConverter.IsLittleEndian) { bytes = new[] { binary.byte7, binary.byte6, binary.byte5, binary.byte4, binary.byte3, binary.byte2, binary.byte1, binary.byte0 }; } else { bytes = new[] { binary.byte0, binary.byte1, binary.byte2, binary.byte3, binary.byte4, binary.byte5, binary.byte6, binary.byte7 }; } writer.Write(bytes); }