private void AcceptClient(IAsyncResult ar) { var socket = Listener.EndAccept(ar); var client = new CoCRemoteClient(this, socket); Clients.Add(client); LoginPacketHandlers.RegisterLoginPacketHandlers(client); InGamePacketHandler.RegisterInGamePacketHandlers(client); Listener.BeginAccept(AcceptClient, Listener); }
private void AcceptClient(IAsyncResult ar) { var socket = Listener.EndAccept(ar); var client = new CoCRemoteClient(this, socket); Console.WriteLine("Accepted new connection: {0}", socket.RemoteEndPoint); // should use a single dictionary of handlers instead. LoginPacketHandlers.RegisterLoginPacketHandlers(client); InGamePacketHandler.RegisterInGamePacketHandlers(client); Clients.Add(client); Listener.BeginAccept(AcceptClient, Listener); }
public CoCClient() { UserID = 0; UserToken = null; Connection = new Socket(SocketType.Stream, ProtocolType.Tcp); PacketLogger = new PacketLogger() { LogConsole = false }; PacketHandlers = new Dictionary <ushort, PacketHandler>(); KeepAliveManager = new KeepAliveManager(this); LoginPacketHandlers.RegisterLoginPacketHandlers(this); InGamePacketHandlers.RegisterInGamePacketHandler(this); }
public CoCClient() { Fingerprint = new Fingerprint(); Home = new Village(); Avatar = new Avatar(); Connection = new Socket(SocketType.Stream, ProtocolType.Tcp); PacketHandlers = new Dictionary <ushort, PacketHandler>(); KeepAliveManager = new KeepAliveManager(this); PacketLogger = new PacketLogger() { LogConsole = false }; LoginPacketHandlers.RegisterLoginPacketHandlers(this); InGamePacketHandlers.RegisterInGamePacketHandler(this); }
public CoCClient() { Fingerprint = new Fingerprint(); // not used Home = new Village(); Avatar = new Avatar(); Connection = new Socket(SocketType.Stream, ProtocolType.Tcp); DefaultPacketHandlers = new Dictionary <ushort, PacketHandler>(); PacketHandlers = new Dictionary <ushort, PacketHandler>(); KeepAliveManager = new KeepAliveManager(this); PacketLog = new PacketLog("packets.log") { AutoSave = true, LogConsole = false }; PluginManager = new PluginManager(this); LoginPacketHandlers.RegisterLoginPacketHandlers(this); InGamePacketHandlers.RegisterInGamePacketHandler(this); PluginManager.LoadPlugins(); PluginManager.EnablePlugins(); }