Пример #1
0
            public void FromStream(ref ByteInputStream reader)
            {
                CurrentPlayers = reader.ReadUInt16_NBO();
                MaxPlayers     = reader.ReadUInt16_NBO();

                ServerName = reader.ReadString(encoding);
                GameType   = reader.ReadString(encoding);
                BuildId    = reader.ReadString(encoding);
                Map        = reader.ReadString(encoding);

                Port = reader.ReadUInt16_NBO();
            }
Пример #2
0
        public void ByteOutputStream_WriteAndReadString_Works()
        {
            var encoding  = new UTF8Encoding();
            var sendShort = "banana";
            var sendLong  = "thisisalongstringrepeatedoverthisisalongstringrepeatedoverthisisalongstringrepeatedoverandoverthisisalongstringrepeatedoverandoverthisisalongstringrepeatedoverandoverthisisalongstringrepeatedoverandoverthisisalongstringrepeatedoverandoverthisisalongstringrepeatedoverandover";
            var sendUTF   = "ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ";

            writer.WriteString(sendShort, encoding);
            writer.WriteString(sendLong, encoding);
            writer.WriteString(sendUTF, encoding);

            var recvShort = reader.ReadString(encoding);
            var recvLong  = reader.ReadString(encoding);
            var recvUTF   = reader.ReadString(encoding);

            Assert.AreEqual(sendShort, recvShort);

            sendLong = sendLong.Substring(0, recvLong.Length);
            Assert.AreEqual(sendLong, recvLong);

            sendUTF = sendUTF.Substring(0, recvUTF.Length);
            Assert.AreEqual(sendUTF, recvUTF);
        }