diff options
author | MW | 2009-02-28 16:42:13 +0000 |
---|---|---|
committer | MW | 2009-02-28 16:42:13 +0000 |
commit | 23a7af4538cb2b3c5b494259c5e36690c52572e0 (patch) | |
tree | 204f8e8e41cca7abc1b27f8036e92e7db4f11602 | |
parent | Copied the Util.ReadSettingsFromIniFile method from the branch to trunk. (diff) | |
download | opensim-SC_OLD-23a7af4538cb2b3c5b494259c5e36690c52572e0.zip opensim-SC_OLD-23a7af4538cb2b3c5b494259c5e36690c52572e0.tar.gz opensim-SC_OLD-23a7af4538cb2b3c5b494259c5e36690c52572e0.tar.bz2 opensim-SC_OLD-23a7af4538cb2b3c5b494259c5e36690c52572e0.tar.xz |
Added check so Util.ReadSettingsFromIniFile doesn't try to set static fields.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Util.cs | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index a0f3567..d978c4c 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -940,25 +940,28 @@ namespace OpenSim.Framework | |||
940 | FieldInfo[] fieldInfos = settingsType.GetFields(); | 940 | FieldInfo[] fieldInfos = settingsType.GetFields(); |
941 | foreach (FieldInfo fieldInfo in fieldInfos) | 941 | foreach (FieldInfo fieldInfo in fieldInfos) |
942 | { | 942 | { |
943 | if (fieldInfo.FieldType == typeof(System.String)) | 943 | if (!fieldInfo.IsStatic) |
944 | { | 944 | { |
945 | fieldInfo.SetValue(settingsClass, config.Get(fieldInfo.Name, (string)fieldInfo.GetValue(settingsClass))); | 945 | if (fieldInfo.FieldType == typeof(System.String)) |
946 | } | 946 | { |
947 | else if (fieldInfo.FieldType == typeof(System.Boolean)) | 947 | fieldInfo.SetValue(settingsClass, config.Get(fieldInfo.Name, (string)fieldInfo.GetValue(settingsClass))); |
948 | { | 948 | } |
949 | fieldInfo.SetValue(settingsClass, config.GetBoolean(fieldInfo.Name, (bool)fieldInfo.GetValue(settingsClass))); | 949 | else if (fieldInfo.FieldType == typeof(System.Boolean)) |
950 | } | 950 | { |
951 | else if (fieldInfo.FieldType == typeof(System.Int32)) | 951 | fieldInfo.SetValue(settingsClass, config.GetBoolean(fieldInfo.Name, (bool)fieldInfo.GetValue(settingsClass))); |
952 | { | 952 | } |
953 | fieldInfo.SetValue(settingsClass, config.GetInt(fieldInfo.Name, (int)fieldInfo.GetValue(settingsClass))); | 953 | else if (fieldInfo.FieldType == typeof(System.Int32)) |
954 | } | 954 | { |
955 | else if (fieldInfo.FieldType == typeof(System.Single)) | 955 | fieldInfo.SetValue(settingsClass, config.GetInt(fieldInfo.Name, (int)fieldInfo.GetValue(settingsClass))); |
956 | { | 956 | } |
957 | fieldInfo.SetValue(settingsClass, config.GetFloat(fieldInfo.Name, (float)fieldInfo.GetValue(settingsClass))); | 957 | else if (fieldInfo.FieldType == typeof(System.Single)) |
958 | } | 958 | { |
959 | else if (fieldInfo.FieldType == typeof(System.UInt32)) | 959 | fieldInfo.SetValue(settingsClass, config.GetFloat(fieldInfo.Name, (float)fieldInfo.GetValue(settingsClass))); |
960 | { | 960 | } |
961 | fieldInfo.SetValue(settingsClass, System.Convert.ToUInt32(config.Get(fieldInfo.Name, ((uint)fieldInfo.GetValue(settingsClass)).ToString()))); | 961 | else if (fieldInfo.FieldType == typeof(System.UInt32)) |
962 | { | ||
963 | fieldInfo.SetValue(settingsClass, System.Convert.ToUInt32(config.Get(fieldInfo.Name, ((uint)fieldInfo.GetValue(settingsClass)).ToString()))); | ||
964 | } | ||
962 | } | 965 | } |
963 | } | 966 | } |
964 | 967 | ||