Exemplo n.º 1
0
        static void InitializeLicenseSystem()
        {
            SetWindowPos(MyConsole, 0, 100, 100, 0, 0, SWP_NOSIZE);

            Console.WindowHeight = Console.LargestWindowHeight - 20;
            Console.WindowWidth = Console.LargestWindowWidth - 20;
            Helpers.Out.startLogger();

            Configuration = new ConfigurationData(@"Settings/configuration.ini");

            conManager = new ConnectionManager.SocketManager();
            conManager.init(int.Parse(Configuration.data["con.socket"]), int.Parse(Configuration.data["con.max_servers"]), int.Parse(Configuration.data["con.con_per_ip"]), new GamePacketParser(), true);

            licenseRequester = new LicenseRequester(conManager);

            manager = new DatabaseManager(uint.Parse(Configuration.data["db.pool.maxsize"]), int.Parse(Configuration.data["db.pool.minsize"]));
            manager.setServerDetails(
                Configuration.data["db.hostname"],
                uint.Parse(Configuration.data["db.port"]),
                Configuration.data["db.username"],
                Configuration.data["db.password"],
                Configuration.data["db.name"]);
            manager.init();

            conManager.initializeConnectionRequests();
            while (Console.ReadLine() != "exit")
            {

            }
            Helpers.Out.stopLogger();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WindowHeight = Console.LargestWindowHeight - 20;
            Console.WindowWidth = Console.LargestWindowWidth - 20;
            Helpers.Out.startLogger(); //START LOGING!!
            ConnectionManager.SocketManager man = new ConnectionManager.SocketManager();
            man.init(9001, 1337, 10, new GamePacketParser(), true);
            man.connectionEvent += new ConnectionManager.SocketManager.ConnectionEvent(man_connectionEvent);
            man.initializeConnectionRequests();

            string s;
            ipcon = new ClientConnectionManager("127.0.0.1", 9001);
            ipcon.OnConnectionChange += new ClientConnectionManager.connectionChanged(ipcon_OnConnectionChange);

            while((s = Console.ReadLine()) != "exit")
            {
                switch (s)
                {
                    case "con":
                        {
                            ipcon.openConnection();
                            break;
                        }
                    case "p":
                        {
                            ipcon.processSyncedMessages();
                            break;
                        }
                }
            }
            ipcon.Dispose();
            man.destroy();
            Out.stopLogger();
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Creates a new Connection witht he given information
        /// </summary>
        /// <param name="dataStream">The Socket of the connection</param>
        /// <param name="connectionID">The id of the connection</param>
        public ConnectionInformation(int connectionID, Socket dataStream, SocketManager manager, IDataParser parser, string ip)
        {
            this.parser = parser;
            buffer = new byte[GameSocketManagerStatics.BUFFER_SIZE];
            this.manager = manager;
            dataSocket = dataStream;
            dataSocket.SendBufferSize = GameSocketManagerStatics.BUFFER_SIZE;
            this.ip = ip;
            sendCallback = sentData;
            this.connectionID = connectionID;
            if (connectionChanged != null)
                connectionChanged.Invoke(this, ConnectionState.OPEN);

        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a new Connection witht he given information
        /// </summary>
        /// <param name="dataStream">The Socket of the connection</param>
        /// <param name="connectionID">The id of the connection</param>
        public ConnectionInformation(Socket dataStream, int connectionID, SocketManager manager, IDataParser parser, string ip, byte[] buffer)
        {
            this.parser = parser;
            this.buffer = buffer;
            this.manager = manager;
            this.dataSocket = dataStream;
            this.dataSocket.SendBufferSize = GameSocketManagerStatics.BUFFER_SIZE;
            this.ip = ip;
            this.connectionID = connectionID;
            this.sendCallback = new AsyncCallback(sentData);
            this.receiveCallback = new AsyncCallback(incomingDataPacket);

            if (connectionChanged != null)
                connectionChanged.Invoke(this, ConnectionState.open);
        }
        /// <summary>
        /// Creates a new Connection witht he given information
        /// </summary>
        /// <param name="dataStream">The Socket of the connection</param>
        /// <param name="connectionID">The id of the connection</param>
        public ConnectionInformation(Socket dataStream, int connectionID, SocketManager manager, IDataParser parser, string ip)
        {
            this.parser = parser;
            this.buffer = new byte[GameSocketManagerStatics.BUFFER_SIZE];
            this.manager = manager;
            this.dataSocket = dataStream;
            this.dataSocket.SendBufferSize = GameSocketManagerStatics.BUFFER_SIZE;
            this.ip = ip;
            this.connectionID = connectionID;
            this.sendCallback = new AsyncCallback(sentData);

            if (connectionChanged != null)
                connectionChanged.Invoke(this, ConnectionState.open);

            MessageLoggerManager.AddMessage(null, connectionID, LogState.ConnectionOpen);
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Console.WindowHeight = Console.LargestWindowHeight - 20;
            Console.WindowWidth  = Console.LargestWindowWidth - 20;
            Helpers.Out.startLogger(); //START LOGING!!
            ConnectionManager.SocketManager man = new ConnectionManager.SocketManager();
            man.init(9001, 1337, 10, new GamePacketParser(), true);
            man.connectionEvent += new ConnectionManager.SocketManager.ConnectionEvent(man_connectionEvent);
            man.initializeConnectionRequests();



            string s;

            ipcon = new ClientConnectionManager("127.0.0.1", 9001);
            ipcon.OnConnectionChange += new ClientConnectionManager.connectionChanged(ipcon_OnConnectionChange);

            while ((s = Console.ReadLine()) != "exit")
            {
                switch (s)
                {
                case "con":
                {
                    ipcon.openConnection();
                    break;
                }

                case "p":
                {
                    ipcon.processSyncedMessages();
                    break;
                }
                }
            }
            ipcon.Dispose();
            man.destroy();
            Out.stopLogger();
        }
Exemplo n.º 7
0
		public ConnectionHandling(int port, int maxConnections, int connectionsPerIP, bool enabeNagles)
		{
			this.manager = new SocketManager();
			this.manager.init(port, maxConnections, connectionsPerIP, new InitialPacketParser(), !enabeNagles);
		}
Exemplo n.º 8
0
 public ConnectionHandeling(int port, int maxConnections, int connectionsPerIP, bool enabeNagles)
 {
     liveConnections = new Hashtable();
     manager = new SocketManager();
     manager.init(port, maxConnections, connectionsPerIP, new InitialPacketParser(), !enabeNagles);
 }
Exemplo n.º 9
0
 public LicenseRequester(SocketManager ipcon)
 {
     this.con = ipcon;
     this.con.connectionEvent += newConnectionRequest;
 }