public void NetUniqueIdTest(byte[] rawData, int bitCount)
        {
            var reader = new NetBitReader(rawData, bitCount);

            reader.SerializePropertyNetId();
            Assert.False(reader.IsError);
            Assert.True(reader.AtEnd());
        }
Esempio n. 2
0
        public void NetUniqueIdTest(byte[] rawData, int bitCount, string expected)
        {
            var reader = new NetBitReader(rawData, bitCount);
            var result = reader.SerializePropertyNetId();

            Assert.Equal(expected, result);
            Assert.False(reader.IsError);
            Assert.True(reader.AtEnd());
        }
Esempio n. 3
0
        public void NetUniqueIdTest3()
        {
            byte[] rawData =
            {
                0x29, 0x08, 0x25, 0x35, 0x43, 0x94, 0x31, 0x47, 0x40, 0x39
            };

            var reader = new NetBitReader(rawData, 80);

            reader.SerializePropertyNetId();
            Assert.True(reader.AtEnd());
        }
Esempio n. 4
0
        public void NetUniqueIdTest2()
        {
            byte[] rawData =
            {
                0x11, 0x10, 0x37, 0xDF, 0x4A, 0x07, 0x98, 0xC2, 0x40, 0x2E, 0xAA, 0x62,
                0x69, 0x47, 0xEC, 0x29, 0x90, 0x3F
            };

            var reader = new NetBitReader(rawData, 144);

            reader.SerializePropertyNetId();
            Assert.True(reader.AtEnd());
        }
Esempio n. 5
0
        private string AsNetId()
        {
            _reader.Reset();

            string netId = _reader.SerializePropertyNetId();

            if (_reader.IsError || !_reader.AtEnd())
            {
                return(null);
            }

            return(netId);
        }
Esempio n. 6
0
        public void NetUniqueIdTest()
        {
            byte[] rawData =
            {
                0x08, 0x31, 0x00, 0x00, 0x00, 0x44, 0x45, 0x53, 0x4B, 0x54, 0x4F, 0x50,
                0x2D, 0x32, 0x32, 0x38, 0x4E, 0x47, 0x43, 0x35, 0x2D, 0x42, 0x39, 0x31,
                0x33, 0x37, 0x31, 0x30, 0x38, 0x34, 0x46, 0x46, 0x32, 0x46, 0x37, 0x45,
                0x35, 0x44, 0x36, 0x38, 0x38, 0x30, 0x31, 0x39, 0x35, 0x30, 0x35, 0x30,
                0x39, 0x41, 0x43, 0x31, 0x34, 0x00
            };

            var reader = new NetBitReader(rawData, 432);

            reader.SerializePropertyNetId();
            Assert.True(reader.AtEnd());
        }
Esempio n. 7
0
        public void Serialize(NetBitReader reader)
        {
            uint total = reader.ReadIntPacked();

            if (total == 0)
            {
                RemoveAll = true;
            }
            else
            {
                uint id = reader.ReadIntPacked();

                if (id == 0)
                {
                    RemoveId = (total);
                }
                else
                {
                    Ids = new string[total];

                    Ids[id - 1] = ParseId();

                    while (id < total)
                    {
                        id = reader.ReadIntPacked();

                        Ids[id - 1] = ParseId();
                    }
                }
            }

            reader.SkipBits(8);

            string ParseId()
            {
                reader.SkipBits(32); //Always the same

                string playerId = reader.SerializePropertyNetId();

                reader.SkipBits(8); //Always 0

                return(playerId);
            }
        }