From f921cb712e67893b44496192e5297335ed65caf7 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 28 May 2019 06:19:38 +1000 Subject: Add [Region] .ini block. For including actual region definition in the normal .ini stack. Same as the usual Region.ini format, except we add a RegionName parameter. --- .../LoadRegions/RegionLoaderFileSystem.cs | 20 +++++++++++++++----- OpenSim/Framework/RegionInfo.cs | 22 ++++++++++++++++++---- 2 files changed, 33 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs index 0187418..4160483 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs @@ -68,9 +68,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions } string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); -//// Causes problems with the actual .ini files if they are in the same place. -//// Coz it tries to load each .ini section as a sim, and hangs. -//// string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); + + string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); // Create an empty Regions.xml if there are no existing config files. if (!allowRegionless && configFiles.Length == 0 /*&& iniFiles.Length == 0*/) @@ -84,7 +83,18 @@ namespace OpenSim.ApplicationPlugins.LoadRegions List regionInfos = new List(); int i = 0; -/* + + IConfig regionConfig = (IConfig)m_configSource.Configs["Region"]; + string name = regionConfig.GetString("RegionName", string.Empty).Trim(); + if (string.Empty != name) + { + RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), string.Empty, false, m_configSource, name); + regionInfos.Add(regionInfo); + + m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName); + i++; + } + foreach (string file in iniFiles) { m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file); @@ -101,7 +111,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions i++; } } -*/ + foreach (string file in configFiles) { m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file); diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 75ed999..8dac0ac 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -197,6 +197,12 @@ namespace OpenSim.Framework { // m_configSource = configSource; + if (string.Empty == filename) + { + ReadNiniConfig(configSource, "Region", configName); + return; + } + if (filename.ToLower().EndsWith(".ini")) { if (!File.Exists(filename)) // New region config request @@ -420,7 +426,7 @@ namespace OpenSim.Framework set { m_remotingPort = value; } } - + /// /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. /// @@ -509,6 +515,10 @@ namespace OpenSim.Framework private void ReadNiniConfig(IConfigSource source, string name) { + ReadNiniConfig(source, name, name); + } + private void ReadNiniConfig(IConfigSource source, string section, string name) + { bool creatingNew = false; if (source.Configs.Count == 0) @@ -544,8 +554,7 @@ namespace OpenSim.Framework source.AddConfig(name); } - RegionName = name; - IConfig config = source.Configs[name]; + IConfig config = source.Configs[section]; // Track all of the keys in this config and remove as they are processed // The remaining keys will be added to generic key-value storage for @@ -556,6 +565,11 @@ namespace OpenSim.Framework allKeys.Add(s); } + // RegionName + // + allKeys.Remove("RegionName"); + RegionName = config.GetString("RegionName", name); + // RegionUUID // allKeys.Remove("RegionUUID"); @@ -670,7 +684,7 @@ namespace OpenSim.Framework m_externalHostName = Util.GetLocalHost().ToString(); m_log.InfoFormat( "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}", - m_externalHostName, name); + m_externalHostName, RegionName); } else if (!m_resolveAddress) { -- cgit v1.1