From 110644c23a8f6c2dedc4392c833101d369c58f3e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 21 Aug 2019 21:23:54 +0100 Subject: [PATCH] Make ReadConfig a general features of consoles, rather than type dependent --- OpenSim/Framework/Console/CommandConsole.cs | 5 +++++ OpenSim/Framework/Console/MockConsole.cs | 3 +++ OpenSim/Framework/Console/RemoteConsole.cs | 2 +- OpenSim/Framework/ICommandConsole.cs | 3 +++ OpenSim/Region/Application/OpenSim.cs | 3 ++- OpenSim/Server/Base/ServicesServerBase.cs | 10 +--------- 6 files changed, 15 insertions(+), 11 deletions(-) mode change 100644 => 100755 OpenSim/Framework/Console/CommandConsole.cs mode change 100644 => 100755 OpenSim/Server/Base/ServicesServerBase.cs diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs old mode 100644 new mode 100755 index 52360b40a2..d2b66189a9 --- a/OpenSim/Framework/Console/CommandConsole.cs +++ b/OpenSim/Framework/Console/CommandConsole.cs @@ -36,6 +36,7 @@ using System.Text.RegularExpressions; using System.Threading; using log4net; using OpenSim.Framework; +using Nini.Config; namespace OpenSim.Framework.Console { @@ -789,5 +790,9 @@ namespace OpenSim.Framework.Console } return cmdinput; } + + public virtual void ReadConfig(IConfigSource configSource) + { + } } } diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs index d68b0668f3..6adc678d27 100755 --- a/OpenSim/Framework/Console/MockConsole.cs +++ b/OpenSim/Framework/Console/MockConsole.cs @@ -30,6 +30,7 @@ using System.Threading; using System.Collections.Generic; using System.Text; using System.Xml; +using Nini.Config; namespace OpenSim.Framework.Console { @@ -69,6 +70,8 @@ namespace OpenSim.Framework.Console public string Prompt(string prompt, string defaultresponse, List options) { return ""; } public string PasswdPrompt(string p) { return ""; } + + public void ReadConfig(IConfigSource configSource) { } } public class MockCommands : ICommands diff --git a/OpenSim/Framework/Console/RemoteConsole.cs b/OpenSim/Framework/Console/RemoteConsole.cs index 11006a98fe..8dc7333b26 100755 --- a/OpenSim/Framework/Console/RemoteConsole.cs +++ b/OpenSim/Framework/Console/RemoteConsole.cs @@ -155,7 +155,7 @@ namespace OpenSim.Framework.Console m_expireTimer.Start(); } - public void ReadConfig(IConfigSource config) + public override void ReadConfig(IConfigSource config) { m_Config = config; diff --git a/OpenSim/Framework/ICommandConsole.cs b/OpenSim/Framework/ICommandConsole.cs index 3db27652e9..043056fd1d 100755 --- a/OpenSim/Framework/ICommandConsole.cs +++ b/OpenSim/Framework/ICommandConsole.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using Nini.Config; using System; using System.Collections.Generic; using System.Xml; @@ -102,5 +103,7 @@ namespace OpenSim.Framework void RunCommand(string cmd); string ReadLine(string p, bool isCommand, bool e); + + void ReadConfig(IConfigSource configSource); } } diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 5cfca6cd1e..50bad616e7 100755 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -199,7 +199,6 @@ namespace OpenSim break; case "rest": m_console = new RemoteConsole("Region"); - ((RemoteConsole)m_console).ReadConfig(Config); break; default: m_console = new LocalConsole("Region", Config.Configs["Startup"]); @@ -207,6 +206,8 @@ namespace OpenSim } } + m_console.ReadConfig(Config); + MainConsole.Instance = m_console; LogEnvironmentInformation(); diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs old mode 100644 new mode 100755 index 422a8bce18..3bede4576c --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -147,23 +147,15 @@ namespace OpenSim.Server.Base consoleType = startupConfig.GetString("console", consoleType); if (consoleType == "basic") - { MainConsole.Instance = new CommandConsole(prompt); - } else if (consoleType == "rest") - { MainConsole.Instance = new RemoteConsole(prompt); - ((RemoteConsole)MainConsole.Instance).ReadConfig(Config); - } else if (consoleType == "mock") - { MainConsole.Instance = new MockConsole(); - } else if (consoleType == "local") - { MainConsole.Instance = new LocalConsole(prompt, startupConfig); - } + MainConsole.Instance.ReadConfig(Config); m_console = MainConsole.Instance; if (logConfig != null)