Пример #1
0
        private static void StartupServers()
        {
            _bnetServer = new MooNetServer();
            _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;
            }
            */
        }
Пример #2
0
        private static void StartupServers()
        {
            MooNetServer = new MooNetServer();
            MooNetServerThread = new Thread(MooNetServer.Run) {IsBackground = true};
            MooNetServerThread.Start();

            GameServer = new GameServer();
            GameServerThread = new Thread(GameServer.Run) { IsBackground = true };
            GameServerThread.Start();

            while (true)
            {
                var line = Console.ReadLine();
                CommandManager.Parse(line);                
            }
        }
Пример #3
0
        public static void StartupServers()
        {
            Form1 pvpgn = new Form1();
            _bnetServer = new MooNetServer();
            _gameServer = new GameServer();

            var bnetServerThread = new Thread(_bnetServer.Run) { IsBackground = true };
            bnetServerThread.Start();
            pvpgn.richTextBox1.Text += "[D3GS] Bnet Server Loaded Successfuly! \n\f";
            //pvpgn.progressBar1.Value = 25;

            var gameServerThread = new Thread(_gameServer.Run) { IsBackground = true };
            gameServerThread.Start();
            pvpgn.richTextBox1.Text += "[D3GS] Game Server Loaded Successfuly! \n\f";
            //pvpgn.progressBar1.Value = 50;
        }
Пример #4
0
        public static void Start(string parameters) // actually server.cs should be providing us start/stop/restart methods /raist.
        {
            var startMooNetServer = false;
            var startGameServer = false;

            if (parameters.ToLower() == "help")
            {
                Console.WriteLine("start [all|mnet|gs]");
                return;
            }

            if (parameters == String.Empty || parameters == "all")
            {
                startMooNetServer = true;
                startGameServer = true;
            }

            if (parameters == "mnet") startMooNetServer = true;
            if (parameters == "gs") startGameServer = true;

            if (startMooNetServer)
            {
                if (MooNetServer == null)
                {
                    MooNetServer = new MooNetServer();
                    MooNetServerThread = new Thread(MooNetServer.Run) { IsBackground = true };
                    MooNetServerThread.Start();
                }
                else Console.WriteLine("MooNet-Server is already running");
            }

            if (startGameServer)
            {
                if (GameServer == null)
                {
                    GameServer = new GameServer();
                    GameServerThread = new Thread(GameServer.Run) { IsBackground = true };
                    GameServerThread.Start();
                }
                else Console.WriteLine("Game-Server is already running");
            }
        }
Пример #5
0
        public static void Stop(string parameters) // actually server.cs should be providing us start/stop/restart methods /raist.
        {
            var stopMooNetServer = false;
            var stopGameServer = false;

            if (parameters.ToLower() == "help")
            {
                Console.WriteLine("stop [all|moonet|gs]");
                return;
            }

            if(parameters==String.Empty || parameters=="all")
            {
                stopMooNetServer = true;
                stopGameServer = true;
            }

            if (parameters == "mnet") stopMooNetServer = true;
            if (parameters == "gs") stopGameServer = true;

            if (stopMooNetServer)
            {
                if (MooNetServer != null)
                {
                    Logger.Warn("Stopping MooNet-Server..");
                    MooNetServer.Shutdown();
                    MooNetServerThread.Abort();
                    MooNetServer = null;
                }
                else Console.WriteLine("MooNet-Server is already stopped");
            }

            if (stopGameServer)
            {
                if (GameServer != null)
                {
                    Logger.Warn("Stopping Game-Server..");
                    GameServer.Shutdown();
                    GameServerThread.Abort();
                    GameServer = null;
                }
                else Console.WriteLine("Game-Server is already stopped");
            }            
        }
Пример #6
0
        public static bool StopGS()
        {
            if (GameServer == null) return false;

            Logger.Warn("Stopping Game-Server..");
            GameServer.Shutdown();
            GameServerThread.Abort();
            GameServer = null;

            return true;
        }
Пример #7
0
        public static bool StartGS()
        {
            if (GameServer != null) return false;

            GameServer = new GameServer();
            GameServerThread = new Thread(GameServer.Run) { IsBackground = true, CurrentCulture = CultureInfo.InvariantCulture };
            GameServerThread.Start();

            return true;
        }
Пример #8
0
        public static bool StartGS()
        {
            if (GameServer != null) return false;

            GameServer = new GameServer();
            GameServerThread = new Thread(GameServer.Run) {IsBackground = true};
            GameServerThread.Start();
            return true;
        }
Пример #9
0
        public static void Shutdown(string parameters)
        {
            if (MooNetServer == null && GameServer == null) return;

            if (MooNetServer != null)
            {
                Logger.Warn("Shutting down MooNet-Server..");
                MooNetServer.Shutdown();
                MooNetServer = null;
            }

            if (GameServer != null)
            {
                Logger.Warn("Shutting down Game-Server..");
                GameServer.Shutdown();
                GameServer = null;
            }
        }