aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs32
1 files changed, 31 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
index 3d715cc..82a4da7 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
@@ -198,7 +198,37 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
198 // ----------------------------------------------------------------- 198 // -----------------------------------------------------------------
199 public bool SetValue(string expr, string value, bool useJson) 199 public bool SetValue(string expr, string value, bool useJson)
200 { 200 {
201 OSD ovalue = useJson ? OSDParser.DeserializeJson(value) : new OSDString(value); 201 OSD ovalue;
202
203 // One note of caution... if you use an empty string in the
204 // structure it will be assumed to be a default value and will
205 // not be seialized in the json
206
207 if (useJson)
208 {
209 // There doesn't appear to be a good way to determine if the
210 // value is valid Json other than to let the parser crash
211 try
212 {
213 ovalue = OSDParser.DeserializeJson(value);
214 }
215 catch (Exception e)
216 {
217 if (value.StartsWith("'") && value.EndsWith("'"))
218 {
219 ovalue = new OSDString(value.Substring(1,value.Length - 2));
220 }
221 else
222 {
223 return false;
224 }
225 }
226 }
227 else
228 {
229 ovalue = new OSDString(value);
230 }
231
202 return SetValueFromExpression(expr,ovalue); 232 return SetValueFromExpression(expr,ovalue);
203 } 233 }
204 234