Exemplo n.º 1
0
        private bool SetupManagers( )
        {
            _dedicatedServerWrapper = DedicatedServerAssemblyWrapper.Instance;
            _pluginManager          = PluginManager.Instance;
            _factionsManager        = FactionsManager.Instance;
            _entityEventManager     = EntityEventManager.Instance;
            _chatManager            = ChatManager.Instance;
            _sessionManager         = SessionManager.Instance;

            return(true);
        }
Exemplo n.º 2
0
        private void RunServer( )
        {
            if (_restartLimit < 0)
            {
                return;
            }

            try
            {
                ExtenderOptions.InstanceName = InstanceName;
                _dedicatedServerWrapper      = DedicatedServerAssemblyWrapper.Instance;
                bool result = _dedicatedServerWrapper.StartServer(_commandLineArgs.InstanceName, _commandLineArgs.InstancePath, !_commandLineArgs.NoConsole);
                ApplicationLog.BaseLog.Info("Server has stopped running");

                _isServerRunning = false;

                _pluginMainLoop.Stop( );
                _autosaveTimer.Stop( );

                _pluginManager.Shutdown( );

                if (!result && _commandLineArgs.CloseOnCrash)
                {
                    Thread.Sleep(5000);
                    Environment.Exit(1);
                }

                if (!result && _commandLineArgs.RestartOnCrash)
                {
                    Thread.Sleep(5000);

                    string restartText = "timeout /t 20\r\n";
                    restartText += string.Format("cd /d \"{0}\"\r\n", System.IO.Path.GetDirectoryName(Application.ExecutablePath));
                    restartText += string.Format("{0} {1}\r\n", System.IO.Path.GetFileName(Application.ExecutablePath), _commandLineArgs.Args);

                    File.WriteAllText("RestartApp.bat", restartText);
                    Process.Start("RestartApp.bat");
                    Environment.Exit(1);
                }

                /*
                 * if (!result)
                 * {
                 *      LogManager.APILog.WriteLineAndConsole("Server crashed, attempting auto-restart ...");
                 *
                 *      TimeSpan timeSinceLastRestart = DateTime.Now - m_lastRestart;
                 *
                 *      //Reset the restart limit if the server has been running for more than 5 minutes before the crash
                 *      if (timeSinceLastRestart.TotalMinutes > 5)
                 *              _restartLimit = 3;
                 *
                 *      _restartLimit--;
                 *
                 *      _isServerRunning = true;
                 *      SectorObjectManager.Instance.IsShutDown = false;
                 *
                 *      _runServerThread = new Thread(new ThreadStart(this.RunServer));
                 *      _runServerThread.Start();
                 * }*/
            }
            catch (Exception ex)
            {
                ApplicationLog.BaseLog.Error(ex);
            }
            finally
            {
                _dedicatedServerWrapper = null;
            }
        }
Exemplo n.º 3
0
        protected bool RunBaseReflectionUnitTests()
        {
            bool result = true;

            if (!DedicatedServerAssemblyWrapper.ReflectionUnitTest())
            {
                result = false;
                BaseLog.Warn("DedicatedServerAssemblyWrapper reflection validation failed!");
            }

            if (!ServerNetworkManager.ReflectionUnitTest())
            {
                result = false;
                BaseLog.Warn("ServerNetworkManager reflection validation failed!");
            }

            if (!UtilityFunctions.ReflectionUnitTest())
            {
                result = false;
                BaseLog.Warn("UtilityFunctions reflection validation failed!");
            }

            if (!ChatManager.ReflectionUnitTest())
            {
                result = false;
                BaseLog.Warn("ChatManager reflection validation failed!");
            }

            if (!PlayerMap.ReflectionUnitTest())
            {
                result = false;
                BaseLog.Warn("PlayerMap reflection validation failed!");
            }

            if (!PlayerManager.ReflectionUnitTest())
            {
                result = false;
                BaseLog.Warn("PlayerManager reflection validation failed!");
            }

            if (!WorldManager.ReflectionUnitTest())
            {
                result = false;
                BaseLog.Warn("WorldManager reflection validation failed!");
            }

            /*
             *          if (!RadioManager.ReflectionUnitTest())
             *          {
             *                  result = false;
             *                  BaseLog.Warn( "RadioManager reflection validation failed!" );
             *          }
             *
             *          if (!RadioManagerNetworkManager.ReflectionUnitTest())
             *          {
             *                  result = false;
             *                  BaseLog.Warn( "RadioManagerNetworkManager reflection validation failed!" );
             *          }
             *
             * if (!FactionsManager.ReflectionUnitTest())
             *          {
             *                  result = false;
             *                  BaseLog.Warn( "FactionsManager reflection validation failed!" );
             *          }
             *
             *          if (!Faction.ReflectionUnitTest())
             *          {
             *                  result = false;
             *                  BaseLog.Warn( "Faction reflection validation failed!" );
             *          }
             */

            if (!GameEntityManager.ReflectionUnitTest())
            {
                result = false;
                BaseLog.Warn("GameEntityManager reflection validation failed!");
            }

            if (result)
            {
                BaseLog.Info("All main types passed reflection unit tests!");
            }

            return(result);
        }