public static void InitHandlers()
        {
            IRSECommandSystem = CommandSystem.Singleton;

            ConsoleCommandManager.InitIRSECommands(IRSECommandSystem);

            IRSECommandSystem.OutputHandler  += new EventHandler <string>(i_outputHandler);
            IRSECommandSystem.SecurityHandler = new Func <object, int, bool>(i_securityHandler);
            IRSECommandSystem.ErrorHandler   += new CommandSystem.ErrorHandlerDelegate(i_errorHandler);
            IRSECommandSystem.InputHandler   += new CommandSystem.InputDelegate(i_inputHandler);
            IRSECommandSystem.ExecuteHandler += new CommandSystem.ExecuteHandlerDelegate(i_executeHandler);
        }
Exemplo n.º 2
0
        internal void Hook()
        {
            m_launchedTime = DateTime.Now;
            try
            {
                Program.SetTitle(true);

                m_handlerManager = new HandlerManager(m_assembly, m_frameworkAssembly);

                WaitForHandlers();

                Game.Server.ControllerManager controllerManager = m_handlerManager.ControllerManager;

                // Intercept events to copy and invoke
                EventManager.Instance.Intercept(controllerManager);

                // command loader
                mainLog.Info("IRSE: Loading Game Console Commands..");
                // soon

                ConsoleCommandManager.InitCommands(controllerManager);



                // start gamelogic coroutine
                Program.ConsoleCoroutine = CommandSystem.Singleton.Logic(controllerManager, Game.Configuration.Globals.NoConsoleAutoComplete);


                SendKeys.SendWait("{ENTER}"); // activates the game console commands

                // plugin loader
                mainLog.Info("IRSE: Initializing Plugins...");
                m_pluginManager = new PluginManager();
                m_pluginManager.InitializeAllPlugins();

                // Wait 5 seconds before activating ServerInstance.Instance.IsRunning

                mainLog.Info("IRSE: Startup Procedure Complete!");
                IsRunning = true; // Server is running by now
            }
            catch (Exception ex)
            {
                mainLog.Info("IRSE: Startup Procedure FAILED!");
                mainLog.Info("IRSE: Haulting Server.. Major problem detected!!!!!!!! - Exception:");
                mainLog.Error(ex.ToString());

                Console.ReadLine();
                Stop();
            }
        }
        public void InitializePlugin(PluginInfo Plugin)
        {
            if (Plugin == null)
            {
                return;
            }
            mainLog.Warn(string.Format(Program.Localization.Sentences["InitializingPlugin"], Plugin.Assembly.GetName().Name));
            bool PluginInitialized = false;

            try
            {
                if (Plugin.MainClass == null)
                {
                    Plugin.MainClass = (PluginBase)Activator.CreateInstance(Plugin.MainClassType);
                }

                if (Plugin.MainClass != null)
                {
                    try
                    {
                        SetupTypes(Plugin);

                        ConsoleCommandManager.InitPluginCommands(ConsoleCommandManager.IRSECommandSystem, Plugin);

                        Plugin.MainClass.Init();

                        PluginInitialized = true;
                    }
                    catch (MissingMethodException)
                    {
                        mainLog.Error(string.Format(Program.Localization.Sentences["InitializationPlugin"], Plugin.Assembly.GetName().Name, Plugin.MainClassType.ToString()));
                    }
                    catch (Exception ex)
                    {
                        mainLog.Error(string.Format(Program.Localization.Sentences["FailedInitPlugin"], Plugin.Assembly.GetName().Name, ex.ToString()));
                    }
                }
            }
            catch (Exception ex)
            {
                mainLog.Warn(string.Format(Program.Localization.Sentences["FailedInitPlugin"], Plugin.Assembly.GetName().Name, ex.ToString()));
            }
            m_loadedPlugins.Find(p => p.MainClass.Enabled == PluginInitialized);
        }
Exemplo n.º 4
0
        internal void Hook()
        {
            m_launchedTime = DateTime.Now;
            try
            {
                m_handlerManager = new HandlerManager(m_assembly, m_frameworkAssembly);

                WaitForHandlers();

                ControllerManager controllerManager = m_handlerManager.ControllerManager;

                // Intercept events to copy and invoke
                EventManager.Instance.Intercept(controllerManager);

                // ir command loader
                mainLog.Info("IRSE: Loading Game Console Commands..");
                ConsoleCommandManager.InitAndReplace(controllerManager);

                Program.ConsoleCoroutine = ConsoleCommandManager.IRSECommandSystem
                                           .Logic(controllerManager, Game.Configuration.Globals.NoConsoleAutoComplete || Program.CommandLineArgs.Contains("-noConsoleAutoComplete"));

                // plugin loader
                mainLog.Info("IRSE: Initializing Plugins...");
                m_pluginManager.InitializeAllPlugins();

                // Wait 5 seconds before activating ServerInstance.Instance.IsRunning
                mainLog.Info("IRSE: Startup Procedure Complete!");

                Program.Wait = false;

                SetIsRunning(); // Server is running by now
                SetIsStarting(false);

                Program.SetTitle(true);
            }
            catch (Exception ex)
            {
                mainLog.Info("IRSE: Startup Procedure FAILED!");
                mainLog.Info("IRSE: Haulting Server.. Major problem detected!!!!!!!! - Exception:");
                mainLog.Error(ex.ToString());

                Stop();
            }
        }