コード例 #1
0
        /// <summary>
        ///     Read the configuration
        /// </summary>
        /// <param name="configSource"></param>
        public virtual void Configuration(IConfigSource configSource)
        {
            IConfig startupConfig = m_config.Configs["Startup"];

            int stpMaxThreads = 15;

            if (startupConfig != null)
            {
                m_startupCommandsFile  = startupConfig.GetString("startup_console_commands_file", "startup_commands.txt");
                m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file",
                                                                 "shutdown_commands.txt");

                m_TimerScriptFileName = startupConfig.GetString("timer_Script", "disabled");
                m_TimerScriptTime     = startupConfig.GetInt("timer_time", m_TimerScriptTime);

                string pidFile = startupConfig.GetString("PIDFile", String.Empty);
                if (pidFile != String.Empty)
                {
                    CreatePIDFile(pidFile);
                }
            }

            IConfig SystemConfig = m_config.Configs["System"];

            if (SystemConfig != null)
            {
                string asyncCallMethodStr = SystemConfig.GetString("AsyncCallMethod", String.Empty);
                FireAndForgetMethod asyncCallMethod;
                if (!String.IsNullOrEmpty(asyncCallMethodStr) &&
                    Utils.EnumTryParse(asyncCallMethodStr, out asyncCallMethod))
                {
                    Util.FireAndForgetMethod = asyncCallMethod;
                }

                stpMaxThreads = SystemConfig.GetInt("MaxPoolThreads", 15);
            }

            if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
            {
                Util.InitThreadPool(stpMaxThreads);
            }

            //Set up console forcefully
            Universe.Services.BaseService consoleService = new Universe.Services.BaseService();
            consoleService.PreStartup(this);

            //Fix the default prompt
            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.DefaultPrompt = m_consolePrompt;
                MainConsole.Instance.Info(string.Format("[Mini Universe]: STARTING MIN Universe ({0})...",
                                                        (IntPtr.Size == 4 ? "x86" : "x64")));
                MainConsole.Instance.Info("[Mini Universe]: Version: " + Version + "\n");
            }
        }
コード例 #2
0
        /// <summary>
        ///     Read the configuration
        /// </summary>
        /// <param name="configSource"></param>
        public virtual void Configuration(IConfigSource configSource)
        {
            IConfig startupConfig = m_config.Configs["Startup"];

            int stpMaxThreads = 15;

            if (startupConfig != null)
            {
                m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", "startup_commands.txt");
                m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file",
                                                                 "shutdown_commands.txt");

                m_TimerScriptFileName = startupConfig.GetString("timer_Script", "disabled");
                m_TimerScriptTime = startupConfig.GetInt("timer_time", m_TimerScriptTime);

                string pidFile = startupConfig.GetString("PIDFile", String.Empty);
                if (pidFile != String.Empty)
                    CreatePIDFile(pidFile);
            }

            IConfig SystemConfig = m_config.Configs["System"];
            if (SystemConfig != null)
            {
                string asyncCallMethodStr = SystemConfig.GetString("AsyncCallMethod", String.Empty);
                FireAndForgetMethod asyncCallMethod;
                if (!String.IsNullOrEmpty(asyncCallMethodStr) &&
                    Utils.EnumTryParse(asyncCallMethodStr, out asyncCallMethod))
                    Util.FireAndForgetMethod = asyncCallMethod;

                stpMaxThreads = SystemConfig.GetInt("MaxPoolThreads", 15);
            }

            if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
                Util.InitThreadPool(stpMaxThreads);

            //Set up console forcefully
            Universe.Services.BaseService consoleService = new Universe.Services.BaseService();
            consoleService.PreStartup(this);

            //Fix the default prompt
            if (MainConsole.Instance != null)
            {
                MainConsole.Instance.DefaultPrompt = m_consolePrompt;
                MainConsole.Instance.Info(string.Format("[Mini Universe]: STARTING MIN Universe ({0})...",
                                                        (IntPtr.Size == 4 ? "x86" : "x64")));
                MainConsole.Instance.Info("[Mini Universe]: Version: " + Version + "\n");
            }
        }