aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index d9148fb..1700d3e 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -863,7 +863,7 @@ namespace OpenSim.Framework
863 return FileName; 863 return FileName;
864 } 864 }
865 865
866 // Nini (config) related Methods 866 #region Nini (config) related Methods
867 public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) 867 public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName)
868 { 868 {
869 if (!File.Exists(fileName)) 869 if (!File.Exists(fileName))
@@ -886,6 +886,26 @@ namespace OpenSim.Framework
886 } 886 }
887 } 887 }
888 888
889 public static string GetConfigVarWithDefaultSection(IConfigSource config, string varname, string section)
890 {
891 // First, check the Startup section, the default section
892 IConfig cnf = config.Configs["Startup"];
893 if (cnf == null)
894 return string.Empty;
895 string val = cnf.GetString(varname, string.Empty);
896
897 // Then check for an overwrite of the default in the given section
898 if (!string.IsNullOrEmpty(section))
899 {
900 cnf = config.Configs[section];
901 if (cnf != null)
902 val = cnf.GetString(varname, val);
903 }
904
905 return val;
906 }
907 #endregion
908
889 public static float Clip(float x, float min, float max) 909 public static float Clip(float x, float min, float max)
890 { 910 {
891 return Math.Min(Math.Max(x, min), max); 911 return Math.Min(Math.Max(x, min), max);