diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 160 | ||||
-rw-r--r-- | OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs | 29 |
2 files changed, 139 insertions, 50 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index db23af9..2423097 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -209,7 +209,7 @@ namespace OpenSim.Framework | |||
209 | public bool isSandbox = false; | 209 | public bool isSandbox = false; |
210 | private EstateSettings m_estateSettings; | 210 | private EstateSettings m_estateSettings; |
211 | private RegionSettings m_regionSettings; | 211 | private RegionSettings m_regionSettings; |
212 | //private IConfigSource m_configSource = null; | 212 | // private IConfigSource m_configSource = null; |
213 | 213 | ||
214 | public UUID MasterAvatarAssignedUUID = UUID.Zero; | 214 | public UUID MasterAvatarAssignedUUID = UUID.Zero; |
215 | public string MasterAvatarFirstName = String.Empty; | 215 | public string MasterAvatarFirstName = String.Empty; |
@@ -238,18 +238,51 @@ namespace OpenSim.Framework | |||
238 | // access the same database server. Since estate settings are lodaed | 238 | // access the same database server. Since estate settings are lodaed |
239 | // from there, that should be sufficient for full remote administration | 239 | // from there, that should be sufficient for full remote administration |
240 | 240 | ||
241 | public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource) | 241 | // File based loading |
242 | // | ||
243 | public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource) : this(description, filename, skipConsoleConfig, configSource, String.Empty) | ||
242 | { | 244 | { |
243 | //m_configSource = configSource; | 245 | } |
246 | |||
247 | public RegionInfo(string description, string filename, bool skipConsoleConfig, IConfigSource configSource, string configName) | ||
248 | { | ||
249 | // m_configSource = configSource; | ||
250 | |||
251 | if (filename.ToLower().EndsWith(".ini")) | ||
252 | { | ||
253 | IConfigSource source = new IniConfigSource(filename); | ||
254 | |||
255 | ReadNiniConfig(source, configName); | ||
256 | |||
257 | return; | ||
258 | } | ||
259 | |||
260 | try | ||
261 | { | ||
262 | // This will throw if it's not legal Nini XML format | ||
263 | // and thereby toss it to the legacy loader | ||
264 | // | ||
265 | IConfigSource xmlsource = new XmlConfigSource(filename); | ||
266 | |||
267 | ReadNiniConfig(xmlsource, configName); | ||
268 | |||
269 | return; | ||
270 | } | ||
271 | catch (Exception) | ||
272 | { | ||
273 | } | ||
274 | |||
244 | configMember = | 275 | configMember = |
245 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); | 276 | new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); |
246 | configMember.performConfigurationRetrieve(); | 277 | configMember.performConfigurationRetrieve(); |
247 | RegionFile = filename; | 278 | RegionFile = filename; |
248 | } | 279 | } |
249 | 280 | ||
281 | // The web loader uses this | ||
282 | // | ||
250 | public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource) | 283 | public RegionInfo(string description, XmlNode xmlNode, bool skipConsoleConfig, IConfigSource configSource) |
251 | { | 284 | { |
252 | //m_configSource = configSource; | 285 | // m_configSource = configSource; |
253 | configMember = | 286 | configMember = |
254 | new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); | 287 | new ConfigurationMember(xmlNode, description, loadConfigurationOptions, handleIncomingConfiguration, !skipConsoleConfig); |
255 | configMember.performConfigurationRetrieve(); | 288 | configMember.performConfigurationRetrieve(); |
@@ -355,53 +388,92 @@ namespace OpenSim.Framework | |||
355 | m_internalEndPoint = tmpEPE; | 388 | m_internalEndPoint = tmpEPE; |
356 | } | 389 | } |
357 | 390 | ||
358 | //not in use, should swap to nini though. | 391 | private void ReadNiniConfig(IConfigSource source, string name) |
359 | public void LoadFromNiniSource(IConfigSource source) | ||
360 | { | 392 | { |
361 | LoadFromNiniSource(source, "RegionInfo"); | 393 | if (name == String.Empty) |
362 | } | 394 | name = source.Configs[0].Name; |
363 | 395 | ||
364 | //not in use, should swap to nini though. | 396 | if (source.Configs[name] == null) |
365 | public void LoadFromNiniSource(IConfigSource source, string sectionName) | 397 | throw new Exception("Config name does not exist"); |
366 | { | ||
367 | string errorMessage = String.Empty; | ||
368 | RegionID = new UUID(source.Configs[sectionName].GetString("Region_ID", UUID.Random().ToString())); | ||
369 | RegionName = source.Configs[sectionName].GetString("sim_name", "OpenSim Test"); | ||
370 | m_regionLocX = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_x", "1000")); | ||
371 | m_regionLocY = Convert.ToUInt32(source.Configs[sectionName].GetString("sim_location_y", "1000")); | ||
372 | // this.DataStore = source.Configs[sectionName].GetString("datastore", "OpenSim.db"); | ||
373 | 398 | ||
374 | string ipAddress = source.Configs[sectionName].GetString("internal_ip_address", "0.0.0.0"); | 399 | IConfig config = source.Configs[name]; |
375 | IPAddress ipAddressResult; | ||
376 | if (IPAddress.TryParse(ipAddress, out ipAddressResult)) | ||
377 | { | ||
378 | m_internalEndPoint = new IPEndPoint(ipAddressResult, 0); | ||
379 | } | ||
380 | else | ||
381 | { | ||
382 | errorMessage = "needs an IP Address (IPAddress)"; | ||
383 | } | ||
384 | m_internalEndPoint.Port = | ||
385 | source.Configs[sectionName].GetInt("internal_ip_port", (int) ConfigSettings.DefaultRegionHttpPort); | ||
386 | 400 | ||
387 | string externalHost = source.Configs[sectionName].GetString("external_host_name", "127.0.0.1"); | 401 | // UUID |
388 | if (externalHost != "SYSTEMIP") | 402 | // |
389 | { | 403 | string regionUUID = config.GetString("RegionUUID", string.Empty); |
390 | m_externalHostName = externalHost; | 404 | |
391 | } | 405 | if (regionUUID == String.Empty) |
392 | else | 406 | throw new Exception("A region UUID is required"); |
393 | { | 407 | |
408 | RegionID = new UUID(regionUUID); | ||
409 | originRegionID = RegionID; // What IS this?! | ||
410 | |||
411 | |||
412 | // Region name | ||
413 | // | ||
414 | RegionName = name; | ||
415 | |||
416 | |||
417 | // Region location | ||
418 | // | ||
419 | string location = config.GetString("Location", String.Empty); | ||
420 | |||
421 | if (location == String.Empty) | ||
422 | throw new Exception("Location is required"); | ||
423 | |||
424 | string[] locationElements = location.Split(new char[] {','}); | ||
425 | |||
426 | m_regionLocX = Convert.ToUInt32(locationElements[0]); | ||
427 | m_regionLocY = Convert.ToUInt32(locationElements[1]); | ||
428 | |||
429 | |||
430 | // Datastore | ||
431 | // | ||
432 | DataStore = config.GetString("Datastore", String.Empty); | ||
433 | |||
434 | |||
435 | // Internal IP | ||
436 | // | ||
437 | IPAddress address = IPAddress.Parse(config.GetString("InternalAddress", "127.0.0.1")); | ||
438 | int port = config.GetInt("InternalPort", 9000); | ||
439 | |||
440 | m_internalEndPoint = new IPEndPoint(address, port); | ||
441 | |||
442 | m_allow_alternate_ports = config.GetBoolean("AllowAlternatePorts", true); | ||
443 | |||
444 | // External IP | ||
445 | // | ||
446 | string externalName = config.GetString("ExternalHostName", "SYSTEMIP"); | ||
447 | if (externalName == "SYSTEMIP") | ||
394 | m_externalHostName = Util.GetLocalHost().ToString(); | 448 | m_externalHostName = Util.GetLocalHost().ToString(); |
395 | } | 449 | else |
450 | m_externalHostName = externalName; | ||
396 | 451 | ||
397 | MasterAvatarFirstName = source.Configs[sectionName].GetString("master_avatar_first", "Test"); | ||
398 | MasterAvatarLastName = source.Configs[sectionName].GetString("master_avatar_last", "User"); | ||
399 | MasterAvatarSandboxPassword = source.Configs[sectionName].GetString("master_avatar_pass", "test"); | ||
400 | 452 | ||
401 | if (errorMessage != String.Empty) | 453 | // Master avatar cruft |
402 | { | 454 | // |
403 | // a error | 455 | string masterAvatarUUID = config.GetString("MasterAvatarUUID", UUID.Zero.ToString()); |
404 | } | 456 | MasterAvatarAssignedUUID = new UUID(masterAvatarUUID); |
457 | |||
458 | MasterAvatarFirstName = config.GetString("MasterAvatarFirstName", String.Empty); | ||
459 | MasterAvatarLastName = config.GetString("MasterAvatarLastName", String.Empty); | ||
460 | MasterAvatarSandboxPassword = config.GetString("MasterAvatarSandboxPassword", String.Empty); | ||
461 | |||
462 | |||
463 | // Prim stuff | ||
464 | // | ||
465 | m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 256); | ||
466 | |||
467 | m_physPrimMax = config.GetInt("PhysicalPrimMax", 10); | ||
468 | |||
469 | m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); | ||
470 | |||
471 | m_objectCapacity = config.GetInt("MaxPrims", 15000); | ||
472 | |||
473 | |||
474 | // Multi-tenancy | ||
475 | // | ||
476 | ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); | ||
405 | } | 477 | } |
406 | 478 | ||
407 | public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) | 479 | public bool ignoreIncomingConfiguration(string configuration_key, object configuration_result) |
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs index c58c41d..b4b15e4 100644 --- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs +++ b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.IO; | 30 | using System.IO; |
30 | using Nini.Config; | 31 | using Nini.Config; |
31 | 32 | ||
@@ -60,21 +61,37 @@ namespace OpenSim.Framework.RegionLoader.Filesystem | |||
60 | } | 61 | } |
61 | 62 | ||
62 | string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); | 63 | string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); |
64 | string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); | ||
63 | 65 | ||
64 | if (configFiles.Length == 0) | 66 | if (configFiles.Length == 0 && iniFiles.Length == 0) |
65 | { | 67 | { |
66 | new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml"), false, m_configSource); | 68 | new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml"), false, m_configSource); |
67 | configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); | 69 | configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); |
68 | } | 70 | } |
69 | 71 | ||
70 | RegionInfo[] regionInfos = new RegionInfo[configFiles.Length]; | 72 | List<RegionInfo> regionInfos = new List<RegionInfo>(); |
71 | for (int i = 0; i < configFiles.Length; i++) | 73 | |
74 | int i = 0; | ||
75 | foreach (string file in iniFiles) | ||
76 | { | ||
77 | IConfigSource source = new IniConfigSource(file); | ||
78 | |||
79 | foreach (IConfig config in source.Configs) | ||
80 | { | ||
81 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); | ||
82 | regionInfos.Add(regionInfo); | ||
83 | i++; | ||
84 | } | ||
85 | } | ||
86 | |||
87 | foreach (string file in configFiles) | ||
72 | { | 88 | { |
73 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i], false, m_configSource); | 89 | RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource); |
74 | regionInfos[i] = regionInfo; | 90 | regionInfos.Add(regionInfo); |
91 | i++; | ||
75 | } | 92 | } |
76 | 93 | ||
77 | return regionInfos; | 94 | return regionInfos.ToArray(); |
78 | } | 95 | } |
79 | } | 96 | } |
80 | } | 97 | } |