From 4b8c22ecfaf573b26e1b8f65cb8c95c39c3f519b Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 12 Feb 2013 11:10:17 -0800 Subject: Adds the parameter for OSD serialization to encode default values. This makes the JsonStore get/set operations symmetric. --- .../Region/OptionalModules/Scripting/JsonStore/JsonStore.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs') diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs index 82a4da7..3bad06c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs @@ -131,15 +131,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore m_TakeStore = new List(); m_ReadStore = new List(); } - + public JsonStore(string value) : this() { + // This is going to throw an exception if the value is not + // a valid JSON chunk. Calling routines should catch the + // exception and handle it appropriately if (String.IsNullOrEmpty(value)) ValueStore = new OSDMap(); else ValueStore = OSDParser.DeserializeJson(value); } - + // ----------------------------------------------------------------- /// /// @@ -574,14 +577,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore // The path pointed to an intermediate hash structure if (result.Type == OSDType.Map) { - value = OSDParser.SerializeJsonString(result as OSDMap); + value = OSDParser.SerializeJsonString(result as OSDMap,true); return true; } // The path pointed to an intermediate hash structure if (result.Type == OSDType.Array) { - value = OSDParser.SerializeJsonString(result as OSDArray); + value = OSDParser.SerializeJsonString(result as OSDArray,true); return true; } -- cgit v1.1