Can now use the xml config file for setting up things like sandbox mode, login server, physics engine etc. To use this mode add just -configfile to the startup line (instead of the -sandbox etc)

A example of what to add to the xml is: SandBox="true" LoginServer="true" UserAccounts="false" LocalAssets="false" PhysicsEngine="basicphysics"  (add those to config node in simconfig.xml). 
The current options for PhysicsEngine are : basicphysics, RealPhysX, OpenDynamicsEngine.
0.1-prestable
MW 2007-04-25 13:47:32 +00:00
parent f7b51d63a8
commit 68b33294b1
2 changed files with 97 additions and 3 deletions

View File

@ -86,12 +86,13 @@ namespace OpenSim
public OpenGridProtocolServer OGSServer;
public bool user_accounts = false;
public bool gridLocalAsset = false;
private bool configFileSetup = false;
protected ConsoleBase m_console;
public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine)
public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile)
{
this.configFileSetup = useConfigFile;
m_sandbox = sandBoxMode;
m_loginserver = startLoginServer;
m_physicsEngine = physicsEngine;
@ -115,6 +116,10 @@ namespace OpenSim
{
Console.WriteLine(e.Message);
}
if (this.configFileSetup)
{
this.SetupFromConfigFile(this.localConfig);
}
m_console.WriteLine("Main.cs:Startup() - Loading configuration");
this.regionData.InitConfig(this.m_sandbox, this.localConfig);
this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change
@ -313,6 +318,90 @@ namespace OpenSim
m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat);
}
private void SetupFromConfigFile(IGenericConfig configData)
{
try
{
// SandBoxMode
string attri = "";
attri = configData.GetAttribute("SandBox");
if (attri == "")
{
this.m_sandbox = false;
configData.SetAttribute("SandBox", "false");
}
else
{
this.m_sandbox = Convert.ToBoolean(attri);
}
// LoginServer
attri = "";
attri = configData.GetAttribute("LoginServer");
if (attri == "")
{
this.m_loginserver = false;
configData.SetAttribute("LoginServer", "false");
}
else
{
this.m_loginserver = Convert.ToBoolean(attri);
}
// Sandbox User accounts
attri = "";
attri = configData.GetAttribute("UserAccount");
if (attri == "")
{
this.user_accounts = false;
configData.SetAttribute("UserAccounts", "false");
}
else
{
this.user_accounts = Convert.ToBoolean(attri);
}
// Grid mode hack to use local asset server
attri = "";
attri = configData.GetAttribute("LocalAssets");
if (attri == "")
{
this.gridLocalAsset = false;
configData.SetAttribute("LocalAssets", "false");
}
else
{
this.gridLocalAsset = Convert.ToBoolean(attri);
}
// Grid mode hack to use local asset server
attri = "";
attri = configData.GetAttribute("PhysicsEngine");
if (attri == "")
{
this.m_physicsEngine = "basicphysics";
configData.SetAttribute("PhysicsEngine", "basicphysics");
}
else
{
this.m_physicsEngine = attri;
if ((attri == "RealPhysX") || (attri == "OpenDynamicsEngine"))
{
OpenSim.world.Avatar.PhysicsEngineFlying = true;
}
else
{
OpenSim.world.Avatar.PhysicsEngineFlying = false;
}
}
configData.Commit();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
private SimConfig LoadConfigDll(string dllName)
{
Assembly pluginAssembly = Assembly.LoadFrom(dllName);

View File

@ -20,6 +20,7 @@ namespace OpenSim
bool allowFlying = false;
bool userAccounts = false;
bool gridLocalAsset = false;
bool useConfigFile = false;
for (int i = 0; i < args.Length; i++)
{
@ -50,9 +51,13 @@ namespace OpenSim
{
gridLocalAsset = true;
}
if (args[i] == "-configfile")
{
useConfigFile = true;
}
}
OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine );
OpenSimMain sim = new OpenSimMain( sandBoxMode, startLoginServer, physicsEngine, useConfigFile);
// OpenSimRoot.Instance.Application = sim;
sim.m_sandbox = sandBoxMode;
sim.user_accounts = userAccounts;