private bool SetupManagers()
        {
            m_serverWrapper       = ServerAssemblyWrapper.Instance;
            m_pluginManager       = PluginManager.Instance;
            m_gameAssemblyWrapper = SandboxGameAssemblyWrapper.Instance;
            m_factionsManager     = FactionsManager.Instance;
            m_logManager          = LogManager.Instance;
            m_entityEventManager  = EntityEventManager.Instance;
            m_chatManager         = ChatManager.Instance;

            return(true);
        }
Example #2
0
        private bool SetupManagers( )
        {
            _serverWrapper       = ServerAssemblyWrapper.Instance;
            _pluginManager       = PluginManager.Instance;
            _gameAssemblyWrapper = SandboxGameAssemblyWrapper.Instance;
            _factionsManager     = FactionsManager.Instance;
            _entityEventManager  = EntityEventManager.Instance;
            _chatManager         = ChatManager.Instance;
            _sessionManager      = SessionManager.Instance;

            return(true);
        }
        private void PluginManagerMain(object sender, EventArgs e)
        {
            if (!Server.Instance.IsRunning)
            {
                m_pluginMainLoop.Stop();
                return;
            }

            if (m_pluginManager == null)
            {
                m_pluginMainLoop.Stop();
                return;
            }

            if (!m_pluginManager.Initialized && !m_pluginManager.Loaded)
            {
                if (SandboxGameAssemblyWrapper.Instance.IsGameStarted)
                {
                    if (CommandLineArgs.worldRequestReplace)
                    {
                        NetworkManager.Instance.ReplaceWorldJoin();
                    }

                    if (CommandLineArgs.worldDataModify)
                    {
                        NetworkManager.Instance.ReplaceWorldData();
                    }

                    SandboxGameAssemblyWrapper.InitAPIGateway();
                    m_pluginManager.LoadPlugins();
                    m_pluginManager.Init();

                    SandboxGameAssemblyWrapper.Instance.GameAction(() =>
                    {
                        AppDomain.CurrentDomain.ClearEventInvocations("_unhandledException");
                    });

                    AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                    //AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                    Application.ThreadException += Application_ThreadException;
                    Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                }
            }
            else
            {
                //Force a refresh of the chat messages before running the plugin update
                List <string> messages = ChatManager.Instance.ChatMessages;

                //Run the plugin update
                m_pluginManager.Update();
            }
        }
Example #4
0
        protected bool RunBaseReflectionUnitTests()
        {
            bool result = true;

            if (!SandboxGameAssemblyWrapper.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("SandboxGameAssemblyWrapper reflection validation failed!");
            }

            if (!ServerAssemblyWrapper.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("ServerAssemblyWrapper reflection validation failed!");
            }

            if (!NetworkManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("NetworkManager reflection validation failed!");
            }

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

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

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

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

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

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

            if (!RadioManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("RadioManager reflection validation failed!");
            }

            if (!RadioManagerNetworkManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("RadioManagerNetworkManager reflection validation failed!");
            }

            if (!PowerManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("PowerManager reflection validation failed!");
            }

            if (!FactionsManager.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("FactionsManager reflection validation failed!");
            }

            if (!Faction.ReflectionUnitTest())
            {
                result = false;
                Console.WriteLine("Faction reflection validation failed!");
            }

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

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

            return(result);
        }