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

            Frames = MsgSerializer.ReadUInt32Array(buffer, ref offset);
            Hashes = MsgSerializer.ReadInt32Array(buffer, ref offset);
        }
Exemple #2
0
        public void ShouldSerializeAndDeserializeInt32Array(int item, int count)
        {
            var value  = Enumerable.Repeat(item, count).ToArray();
            var buffer = new byte[MsgSerializer.SizeOf(value)];

            MsgSerializer.WriteInt32Array(value, buffer, 0);

            var offset       = 0;
            var deserialized = MsgSerializer.ReadInt32Array(buffer, ref offset);

            Assert.True(value.Length == deserialized.Length, "Length mismatch");

            for (var i = 0; i < value.Length; i++)
            {
                Assert.True(value[i] == deserialized[i], $"Values mismatch at {i}");
            }
        }