Make ReadConfig a general features of consoles, rather than type dependent

0.9.1.0-post-fixes
Melanie 2019-08-21 21:23:54 +01:00
parent 7e136c67fd
commit 110644c23a
6 changed files with 15 additions and 11 deletions

5
OpenSim/Framework/Console/CommandConsole.cs Normal file → Executable file
View File

@ -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)
{
}
}
}

View File

@ -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<string> options) { return ""; }
public string PasswdPrompt(string p) { return ""; }
public void ReadConfig(IConfigSource configSource) { }
}
public class MockCommands : ICommands

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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();

10
OpenSim/Server/Base/ServicesServerBase.cs Normal file → Executable file
View File

@ -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)