diff options
Diffstat (limited to 'OpenSim.RegionServer/OpenSimMain.cs')
-rw-r--r-- | OpenSim.RegionServer/OpenSimMain.cs | 93 |
1 files changed, 91 insertions, 2 deletions
diff --git a/OpenSim.RegionServer/OpenSimMain.cs b/OpenSim.RegionServer/OpenSimMain.cs index e3e9b98..dc6a363 100644 --- a/OpenSim.RegionServer/OpenSimMain.cs +++ b/OpenSim.RegionServer/OpenSimMain.cs | |||
@@ -86,12 +86,13 @@ namespace OpenSim | |||
86 | public OpenGridProtocolServer OGSServer; | 86 | public OpenGridProtocolServer OGSServer; |
87 | public bool user_accounts = false; | 87 | public bool user_accounts = false; |
88 | public bool gridLocalAsset = false; | 88 | public bool gridLocalAsset = false; |
89 | 89 | private bool configFileSetup = false; | |
90 | 90 | ||
91 | protected ConsoleBase m_console; | 91 | protected ConsoleBase m_console; |
92 | 92 | ||
93 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine) | 93 | public OpenSimMain(bool sandBoxMode, bool startLoginServer, string physicsEngine, bool useConfigFile) |
94 | { | 94 | { |
95 | this.configFileSetup = useConfigFile; | ||
95 | m_sandbox = sandBoxMode; | 96 | m_sandbox = sandBoxMode; |
96 | m_loginserver = startLoginServer; | 97 | m_loginserver = startLoginServer; |
97 | m_physicsEngine = physicsEngine; | 98 | m_physicsEngine = physicsEngine; |
@@ -115,6 +116,10 @@ namespace OpenSim | |||
115 | { | 116 | { |
116 | Console.WriteLine(e.Message); | 117 | Console.WriteLine(e.Message); |
117 | } | 118 | } |
119 | if (this.configFileSetup) | ||
120 | { | ||
121 | this.SetupFromConfigFile(this.localConfig); | ||
122 | } | ||
118 | m_console.WriteLine("Main.cs:Startup() - Loading configuration"); | 123 | m_console.WriteLine("Main.cs:Startup() - Loading configuration"); |
119 | this.regionData.InitConfig(this.m_sandbox, this.localConfig); | 124 | this.regionData.InitConfig(this.m_sandbox, this.localConfig); |
120 | this.localConfig.Close();//for now we can close it as no other classes read from it , but this should change | 125 | 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 | |||
313 | m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); | 318 | m_heartbeatTimer.Elapsed += new ElapsedEventHandler(this.Heartbeat); |
314 | } | 319 | } |
315 | 320 | ||
321 | private void SetupFromConfigFile(IGenericConfig configData) | ||
322 | { | ||
323 | try | ||
324 | { | ||
325 | // SandBoxMode | ||
326 | string attri = ""; | ||
327 | attri = configData.GetAttribute("SandBox"); | ||
328 | if (attri == "") | ||
329 | { | ||
330 | this.m_sandbox = false; | ||
331 | configData.SetAttribute("SandBox", "false"); | ||
332 | } | ||
333 | else | ||
334 | { | ||
335 | this.m_sandbox = Convert.ToBoolean(attri); | ||
336 | } | ||
337 | |||
338 | // LoginServer | ||
339 | attri = ""; | ||
340 | attri = configData.GetAttribute("LoginServer"); | ||
341 | if (attri == "") | ||
342 | { | ||
343 | this.m_loginserver = false; | ||
344 | configData.SetAttribute("LoginServer", "false"); | ||
345 | } | ||
346 | else | ||
347 | { | ||
348 | this.m_loginserver = Convert.ToBoolean(attri); | ||
349 | } | ||
350 | |||
351 | // Sandbox User accounts | ||
352 | attri = ""; | ||
353 | attri = configData.GetAttribute("UserAccount"); | ||
354 | if (attri == "") | ||
355 | { | ||
356 | this.user_accounts = false; | ||
357 | configData.SetAttribute("UserAccounts", "false"); | ||
358 | } | ||
359 | else | ||
360 | { | ||
361 | this.user_accounts = Convert.ToBoolean(attri); | ||
362 | } | ||
363 | |||
364 | // Grid mode hack to use local asset server | ||
365 | attri = ""; | ||
366 | attri = configData.GetAttribute("LocalAssets"); | ||
367 | if (attri == "") | ||
368 | { | ||
369 | this.gridLocalAsset = false; | ||
370 | configData.SetAttribute("LocalAssets", "false"); | ||
371 | } | ||
372 | else | ||
373 | { | ||
374 | this.gridLocalAsset = Convert.ToBoolean(attri); | ||
375 | } | ||
376 | |||
377 | // Grid mode hack to use local asset server | ||
378 | attri = ""; | ||
379 | attri = configData.GetAttribute("PhysicsEngine"); | ||
380 | if (attri == "") | ||
381 | { | ||
382 | this.m_physicsEngine = "basicphysics"; | ||
383 | configData.SetAttribute("PhysicsEngine", "basicphysics"); | ||
384 | } | ||
385 | else | ||
386 | { | ||
387 | this.m_physicsEngine = attri; | ||
388 | if ((attri == "RealPhysX") || (attri == "OpenDynamicsEngine")) | ||
389 | { | ||
390 | OpenSim.world.Avatar.PhysicsEngineFlying = true; | ||
391 | } | ||
392 | else | ||
393 | { | ||
394 | OpenSim.world.Avatar.PhysicsEngineFlying = false; | ||
395 | } | ||
396 | } | ||
397 | configData.Commit(); | ||
398 | } | ||
399 | catch (Exception e) | ||
400 | { | ||
401 | Console.WriteLine(e.Message); | ||
402 | } | ||
403 | } | ||
404 | |||
316 | private SimConfig LoadConfigDll(string dllName) | 405 | private SimConfig LoadConfigDll(string dllName) |
317 | { | 406 | { |
318 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); | 407 | Assembly pluginAssembly = Assembly.LoadFrom(dllName); |