/// <summary> /// Read the configuration /// </summary> /// <param name="configSource"></param> public virtual void Configuration(IConfigSource configSource) { IConfig startupConfig = m_config.Configs["Startup"]; int stpMinThreads = 15; int stpMaxThreads = 300; if (startupConfig != null) { m_defaultDataPath = startupConfig.GetString("DataDirectory", Constants.DEFAULT_DATA_DIR); if (m_defaultDataPath == "") m_defaultDataPath = Constants.DEFAULT_DATA_DIR; 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; stpMinThreads = SystemConfig.GetInt("MinPoolThreads", stpMinThreads); stpMaxThreads = SystemConfig.GetInt("MaxPoolThreads", stpMaxThreads); if (stpMinThreads < 2) stpMinThreads = 2; if (stpMaxThreads < 2) stpMaxThreads = 2; if (stpMinThreads > stpMaxThreads) stpMinThreads = stpMaxThreads; } var mapConfig = m_config.Configs ["WebInterface"]; if (mapConfig != null) { m_mapcenter_x = mapConfig.GetInt ("mapcenter_x", m_mapcenter_x); m_mapcenter_y = mapConfig.GetInt ("mapcenter_y", m_mapcenter_y); } if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) Util.InitThreadPool(stpMinThreads, stpMaxThreads); //Set up console forcefully Services.BaseService consoleService = new Services.BaseService(); consoleService.PreStartup(this); //Fix the default prompt MainConsole.Instance.DefaultPrompt = m_consolePrompt; }
/// <summary> /// Read the configuration /// </summary> /// <param name="configSource"></param> public virtual void Configuration(IConfigSource configSource) { IConfig startupConfig = m_config.Configs["Startup"]; int stpMinThreads = 15; int stpMaxThreads = 300; if (startupConfig != null) { m_defaultDataPath = startupConfig.GetString("DataDirectory", Constants.DEFAULT_DATA_DIR); if (m_defaultDataPath == "") { m_defaultDataPath = Constants.DEFAULT_DATA_DIR; } 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; } stpMinThreads = SystemConfig.GetInt("MinPoolThreads", stpMinThreads); stpMaxThreads = SystemConfig.GetInt("MaxPoolThreads", stpMaxThreads); if (stpMinThreads < 2) { stpMinThreads = 2; } if (stpMaxThreads < 2) { stpMaxThreads = 2; } if (stpMinThreads > stpMaxThreads) { stpMinThreads = stpMaxThreads; } } var mapConfig = m_config.Configs ["WebInterface"]; if (mapConfig != null) { m_mapcenter_x = mapConfig.GetInt("mapcenter_x", m_mapcenter_x); m_mapcenter_y = mapConfig.GetInt("mapcenter_y", m_mapcenter_y); } if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) { Util.InitThreadPool(stpMinThreads, stpMaxThreads); } //Set up console forcefully Services.BaseService consoleService = new Services.BaseService(); consoleService.PreStartup(this); //Fix the default prompt MainConsole.Instance.DefaultPrompt = m_consolePrompt; }