示例#1
0
        public ClientMsgJoin(byte[] buffer, int offset)
        {
            MsgSerializer.ValidateHeader(buffer, MsgId, ref offset);

            Game       = MsgSerializer.ReadString(buffer, ref offset);
            Version    = MsgSerializer.ReadUInt16(buffer, ref offset);
            PlayerName = MsgSerializer.ReadString(buffer, ref offset);
        }
示例#2
0
        public void ShouldSerializeAndDeserializeString(string value)
        {
            var buf = new byte[MsgSerializer.SizeOf(value)];

            MsgSerializer.WriteString(value, buf, 0);

            var offset       = 0;
            var deserialized = MsgSerializer.ReadString(buf, ref offset);

            Assert.True(value == deserialized, $"'{value}' != '{deserialized}'");
        }