Esempio n. 1
0
        public void Broadcast(ISendablePacket packet)
        {
            byte[] buffer;
            int    length = packet.Write(this, out buffer);

            Character.Broadcast(packet);
        }
Esempio n. 2
0
        public async Task SendPacketAsync(ISendablePacket packet)
        {
            byte[] buffer;
            int    length = packet.Write(this, out buffer);

            // Encrypt data block
            length = Encrypt(buffer, 0, length);

            // Create header
            byte[] header = BitConverter.GetBytes((short)(length + 2));

            // Send packet
            try
            {
                await SendPacketAsync(header, buffer, 0, length);
            }
            catch (Exception ex)
            {
            }
        }