From d9528bd06e770d9d0bfc1c34d83abb02e7489e66 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 25 Jun 2009 15:48:54 +0000 Subject: Allow the reading of ini files instead of xml files when reading region definitions from the file system --- .../Filesystem/RegionLoaderFileSystem.cs | 29 +++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs') 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 @@ */ using System; +using System.Collections.Generic; using System.IO; using Nini.Config; @@ -60,21 +61,37 @@ namespace OpenSim.Framework.RegionLoader.Filesystem } string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); + string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini"); - if (configFiles.Length == 0) + if (configFiles.Length == 0 && iniFiles.Length == 0) { new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "default.xml"), false, m_configSource); configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); } - RegionInfo[] regionInfos = new RegionInfo[configFiles.Length]; - for (int i = 0; i < configFiles.Length; i++) + List regionInfos = new List(); + + int i = 0; + foreach (string file in iniFiles) + { + IConfigSource source = new IniConfigSource(file); + + foreach (IConfig config in source.Configs) + { + RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name); + regionInfos.Add(regionInfo); + i++; + } + } + + foreach (string file in configFiles) { - RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), configFiles[i], false, m_configSource); - regionInfos[i] = regionInfo; + RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource); + regionInfos.Add(regionInfo); + i++; } - return regionInfos; + return regionInfos.ToArray(); } } } -- cgit v1.1