From 8d7464d0de47f105d335e58183b4de658d580b34 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 8 Sep 2020 21:27:36 +1000 Subject: Don't read .ini region files, use .xml instead. Add [Region] .ini block. Coz OpenSim can get confused, and I have a better idea - 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 | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'OpenSim/ApplicationPlugins') diff --git a/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs index 976714c..77a2c27 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs @@ -70,11 +70,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); - // Create an empty Regions.ini if there are no existing config files. - if (!allowRegionless && configFiles.Length == 0 && iniFiles.Length == 0) + // Create an empty Regions.xml if there are no existing config files. + if (!allowRegionless && configFiles.Length == 0 /*&& iniFiles.Length == 0*/) { - new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource); - iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); + new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.xml"), false, m_configSource); + configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); } m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config files from {0}", regionConfigPath); @@ -82,6 +82,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); @@ -114,4 +126,5 @@ namespace OpenSim.ApplicationPlugins.LoadRegions return regionInfos.ToArray(); } } -} \ No newline at end of file +} + -- cgit v1.1