示例#1
0
        public Server(MainForm form)
        {
            this.form = form;

            try {
                database = new Database(this);

                gameServers = database.GetAllGameServers();
                LinkProcesses(gameServers);

                registrationAutomation = new RegistrationAutomation(this);

                form.InitializeGameServerPanel(gameServers);

                socketListener = new SocketListener(this, 33333); // 33333
                socketListener.SocketMessageReceived += OnMessageReceive;

                performanceMonitor = new PerformanceMonitor();
                performanceMonitor.OnPerformanceTick += OnPerformanceTick;

                string path = AppDomain.CurrentDomain.BaseDirectory + @"\exceptions.txt";
                if(!File.Exists(path)) {
                    File.CreateText(path);
                }

                AppDomain.CurrentDomain.UnhandledException += UnhandledException;
            }
            catch (Exception ex) {
                form.Output("INIT ERROR: " + ex.Message);
            }
        }
        public RegistrationAutomation(Server server)
        {
            this.server = server;
            this.database = server.Database;

            Timer registrationTimer = new Timer();
            registrationTimer.Elapsed += new ElapsedEventHandler(OnRegistrationTimer);
            registrationTimer.Interval = 5000;
            registrationTimer.Enabled = true;

            server.Form.Output("RA object created");
        }