Esempio n. 1
0
        public void MakePacketAndSend(Socket s, byte[] data)
        {
            short ContentLenght = (short)data.Length;
            byte  RandomPubKey  = XCript.AddRandPubKey();

            using (MemoryStream stream = new MemoryStream())
            {
                int len = 0;
                using (BinaryWriter bw = new BinaryWriter(stream, Encoding.UTF8))
                {
                    bw.Write((short)ContentLenght);
                    bw.Write((byte)RandomPubKey);
                    bw.Write(XCript.Encrypt(data, XCript.GetPubKeyIndex(RandomPubKey), XCript.ZoneServerPrivKey));
                    len = (int)bw.BaseStream.Length;
                }
                stream.Flush();
                byte[] buffer = stream.GetBuffer();
                Array.Resize(ref buffer, len);

                GamePacket packet = new GamePacket(buffer, s);

                this.AddGamePacket(packet);
            }
        }
Esempio n. 2
0
 private void SendPacket(GamePacket packet)
 {
     Server.SendPacket(packet);
 }
Esempio n. 3
0
 public void AddGamePacket(GamePacket gamePacket)
 {
     game_packets.Enqueue(gamePacket);
 }