Make ReadConfig a general features of consoles, rather than type dependent
parent
7e136c67fd
commit
110644c23a
|
@ -36,6 +36,7 @@ using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Console
|
namespace OpenSim.Framework.Console
|
||||||
{
|
{
|
||||||
|
@ -789,5 +790,9 @@ namespace OpenSim.Framework.Console
|
||||||
}
|
}
|
||||||
return cmdinput;
|
return cmdinput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void ReadConfig(IConfigSource configSource)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ using System.Threading;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using Nini.Config;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Console
|
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 Prompt(string prompt, string defaultresponse, List<string> options) { return ""; }
|
||||||
|
|
||||||
public string PasswdPrompt(string p) { return ""; }
|
public string PasswdPrompt(string p) { return ""; }
|
||||||
|
|
||||||
|
public void ReadConfig(IConfigSource configSource) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MockCommands : ICommands
|
public class MockCommands : ICommands
|
||||||
|
|
|
@ -155,7 +155,7 @@ namespace OpenSim.Framework.Console
|
||||||
m_expireTimer.Start();
|
m_expireTimer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReadConfig(IConfigSource config)
|
public override void ReadConfig(IConfigSource config)
|
||||||
{
|
{
|
||||||
m_Config = config;
|
m_Config = config;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using Nini.Config;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
@ -102,5 +103,7 @@ namespace OpenSim.Framework
|
||||||
void RunCommand(string cmd);
|
void RunCommand(string cmd);
|
||||||
|
|
||||||
string ReadLine(string p, bool isCommand, bool e);
|
string ReadLine(string p, bool isCommand, bool e);
|
||||||
|
|
||||||
|
void ReadConfig(IConfigSource configSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,6 @@ namespace OpenSim
|
||||||
break;
|
break;
|
||||||
case "rest":
|
case "rest":
|
||||||
m_console = new RemoteConsole("Region");
|
m_console = new RemoteConsole("Region");
|
||||||
((RemoteConsole)m_console).ReadConfig(Config);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
m_console = new LocalConsole("Region", Config.Configs["Startup"]);
|
m_console = new LocalConsole("Region", Config.Configs["Startup"]);
|
||||||
|
@ -207,6 +206,8 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_console.ReadConfig(Config);
|
||||||
|
|
||||||
MainConsole.Instance = m_console;
|
MainConsole.Instance = m_console;
|
||||||
|
|
||||||
LogEnvironmentInformation();
|
LogEnvironmentInformation();
|
||||||
|
|
|
@ -147,23 +147,15 @@ namespace OpenSim.Server.Base
|
||||||
consoleType = startupConfig.GetString("console", consoleType);
|
consoleType = startupConfig.GetString("console", consoleType);
|
||||||
|
|
||||||
if (consoleType == "basic")
|
if (consoleType == "basic")
|
||||||
{
|
|
||||||
MainConsole.Instance = new CommandConsole(prompt);
|
MainConsole.Instance = new CommandConsole(prompt);
|
||||||
}
|
|
||||||
else if (consoleType == "rest")
|
else if (consoleType == "rest")
|
||||||
{
|
|
||||||
MainConsole.Instance = new RemoteConsole(prompt);
|
MainConsole.Instance = new RemoteConsole(prompt);
|
||||||
((RemoteConsole)MainConsole.Instance).ReadConfig(Config);
|
|
||||||
}
|
|
||||||
else if (consoleType == "mock")
|
else if (consoleType == "mock")
|
||||||
{
|
|
||||||
MainConsole.Instance = new MockConsole();
|
MainConsole.Instance = new MockConsole();
|
||||||
}
|
|
||||||
else if (consoleType == "local")
|
else if (consoleType == "local")
|
||||||
{
|
|
||||||
MainConsole.Instance = new LocalConsole(prompt, startupConfig);
|
MainConsole.Instance = new LocalConsole(prompt, startupConfig);
|
||||||
}
|
|
||||||
|
|
||||||
|
MainConsole.Instance.ReadConfig(Config);
|
||||||
m_console = MainConsole.Instance;
|
m_console = MainConsole.Instance;
|
||||||
|
|
||||||
if (logConfig != null)
|
if (logConfig != null)
|
||||||
|
|
Loading…
Reference in New Issue