コード例 #1
0
        public override byte[] ToBytes()
        {
            byte[] nameData = Settings.NetworkMessageTextEncoder.GetBytes(ClientName);
            byte[] idData   = ClientId.ToByteArray();
            byte[] verBuff  = Settings.NetworkMessageTextEncoder.GetBytes(Version);
            byte[] data     = WritePacketInfo(this, nameData.Length + idData.Length + DisplayConfig.Length + verBuff.Length + 12);
            Buffer.BlockCopy(BitConverter.GetBytes(nameData.Length), 0, data, 21, 4);
            Buffer.BlockCopy(nameData, 0, data, 25, nameData.Length);
            Buffer.BlockCopy(idData, 0, data, 25 + nameData.Length, 16);
            Buffer.BlockCopy(BitConverter.GetBytes(DisplayConfig.Length), 0, data, 25 + nameData.Length + 16, 4);
            Buffer.BlockCopy(DisplayConfig, 0, data, 25 + nameData.Length + 20, DisplayConfig.Length);


            Buffer.BlockCopy(BitConverter.GetBytes(verBuff.Length), 0, data, 45 + nameData.Length + DisplayConfig.Length, 4);
            Buffer.BlockCopy(verBuff, 0, data, 49 + nameData.Length + DisplayConfig.Length, verBuff.Length);
            return(data);
        }