diff options
author | Melanie | 2013-02-22 01:28:54 +0000 |
---|---|---|
committer | Melanie | 2013-02-22 01:28:54 +0000 |
commit | 9534d5f9296979b68550177a5201c2bdba84f14e (patch) | |
tree | 1d39dee6d1eaed10b1146a9ee59a6deaa062bae2 /OpenSim/Framework/Util.cs | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-9534d5f9296979b68550177a5201c2bdba84f14e.zip opensim-SC-9534d5f9296979b68550177a5201c2bdba84f14e.tar.gz opensim-SC-9534d5f9296979b68550177a5201c2bdba84f14e.tar.bz2 opensim-SC-9534d5f9296979b68550177a5201c2bdba84f14e.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 0545365..724e38b 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -875,7 +875,7 @@ namespace OpenSim.Framework | |||
875 | return FileName; | 875 | return FileName; |
876 | } | 876 | } |
877 | 877 | ||
878 | // Nini (config) related Methods | 878 | #region Nini (config) related Methods |
879 | public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) | 879 | public static IConfigSource ConvertDataRowToXMLConfig(DataRow row, string fileName) |
880 | { | 880 | { |
881 | if (!File.Exists(fileName)) | 881 | if (!File.Exists(fileName)) |
@@ -898,6 +898,26 @@ namespace OpenSim.Framework | |||
898 | } | 898 | } |
899 | } | 899 | } |
900 | 900 | ||
901 | public static string GetConfigVarWithDefaultSection(IConfigSource config, string varname, string section) | ||
902 | { | ||
903 | // First, check the Startup section, the default section | ||
904 | IConfig cnf = config.Configs["Startup"]; | ||
905 | if (cnf == null) | ||
906 | return string.Empty; | ||
907 | string val = cnf.GetString(varname, string.Empty); | ||
908 | |||
909 | // Then check for an overwrite of the default in the given section | ||
910 | if (!string.IsNullOrEmpty(section)) | ||
911 | { | ||
912 | cnf = config.Configs[section]; | ||
913 | if (cnf != null) | ||
914 | val = cnf.GetString(varname, val); | ||
915 | } | ||
916 | |||
917 | return val; | ||
918 | } | ||
919 | #endregion | ||
920 | |||
901 | public static float Clip(float x, float min, float max) | 921 | public static float Clip(float x, float min, float max) |
902 | { | 922 | { |
903 | return Math.Min(Math.Max(x, min), max); | 923 | return Math.Min(Math.Max(x, min), max); |