public GameClient(L2Connection l2Connection) { L2Connection = l2Connection; packetHandler = new ServerPacketHandler(this); L2Connection.ReceivedPacket += LoggingReceivedPacket; L2Connection.SendingPacket += LoggingSendPacket; l2Connection.ReceivedPacket += OnReadAsync; }
public void Handle(TcpClient tcpClient) { byte[] key = BlowFishKeygen.GetRandomKey(); var crypt = new GameCrypt(key); var connection = new L2Connection(tcpClient, crypt); var loginClient = new GameClient(connection); clients.Add(loginClient); }
public void Handle(TcpClient tcpClient) { byte[] blowfishKey = new byte[16]; new Random().NextBytes(blowfishKey); var crypt = new LoginCrypt(blowfishKey); var connection = new L2Connection(tcpClient, crypt); var loginClient = new LoginClient(scrambledKeyPair, blowfishKey, connection); clients.Add(loginClient); }
public LoginClient(ScrambledKeyPair scrambledKeyPair, byte[] blowfishKey, L2Connection l2Connection) { this.L2Connection = l2Connection; Random rnd = new Random(); SessionId = rnd.Next(); SessionKey = new SessionKey(rnd.Next(), rnd.Next(), rnd.Next(), rnd.Next()); RsaPair = scrambledKeyPair; ie = GetPacketAction().GetEnumerator(); ie.MoveNext(); _ = Task.Factory.StartNew(() => SendAsync(ie.Current)); L2Connection.ReceivedPacket += LoggingReceivedPacket; L2Connection.SendingPacket += LoggingSendPacket; l2Connection.ReceivedPacket += OnReadAsync; l2Connection.Crypt.EnableCrypt(); }