Exemple #1
0
        private static void StartupServers()
        {
            _bnetServer = new BnetServer();
            _gameServer = new GameServer();

            var bnetServerThread = new Thread(_bnetServer.Run) { IsBackground = true };
            bnetServerThread.Start();

            var gameServerThread = new Thread(_gameServer.Run) { IsBackground = true };
            gameServerThread.Start();

            // Read user input indefinitely
            // TODO: Replace with proper command parsing and execution
            while (true)
            {
                var line = Console.ReadLine();
                if (!string.Equals("quit", line, StringComparison.OrdinalIgnoreCase)
                 && !string.Equals("exit", line, StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                Logger.Info("Shutting down servers...");
                _bnetServer.Shutdown();
                _gameServer.Shutdown();
                break;
            }
        }
Exemple #2
0
        public void StartupServers()
        {
            Application.OpenForms["ToonItems"].Close();

            AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler; // watch for unhandled-exceptions.

            LogManager.Enabled = true; // enable the logger.
            LogManager.AttachLogTarget(new ConsoleTarget(Level.Trace)); // attach a console-target.
            LogManager.AttachLogTarget(new FileTarget(Level.Trace, "log.txt")); // attach a console-target.

            PrintLicence();

            Logger.Info("D3Sharp v{0} warming-up..", Assembly.GetExecutingAssembly().GetName().Version);


            _bnetServer = new BnetServer();
            _gameServer = new GameServer();

            var bnetServerThread = new Thread(_bnetServer.Run) { IsBackground = true };
            bnetServerThread.Start();

            var gameServerThread = new Thread(_gameServer.Run) { IsBackground = true };
            gameServerThread.Start();

            // Read user input indefinitely.
            while (true)
            {
                var line = Console.ReadLine();

                if (!string.Equals("quit", line, StringComparison.OrdinalIgnoreCase)
                    && !string.Equals("exit", line, StringComparison.OrdinalIgnoreCase))
                {
                    continue;
                }

                Logger.Info("Shutting down servers...");
                _bnetServer.Shutdown();
                _gameServer.Shutdown();
            }
        }