Exemple #1
0
        private BDPacket ProcessPacket(byte[] buffer)
        {
            var packet = new BDPacket(buffer);

            if (packet.PacketId == 0x03EB)
            {
                cryptoTransformer = new BDTransformer(packet.ToArray().Extract(5));
            }

            if (packet.IsEncrypted)
            {
                packet.Transform(ref cryptoTransformer, false);
            }

            return(packet);
        }
Exemple #2
0
        public void SendToGame(BDPacket packet)
        {
            if (packet == null)
            {
                return;
            }

            if (packet.IsEncrypted)
            {
                packet.Transform(ref cryptoTransformer, true);
            }

            connectionSocket.BeginSend(packet.ToArray(), 0, packet.Length, SocketFlags.None, ar =>
            {
                connectionSocket.EndSend(ar);
            }, null);
        }