Adds the parameter for OSD serialization to encode default values. This

makes the JsonStore get/set operations symmetric.
0.7.4-extended
Mic Bowman 2013-02-12 11:10:17 -08:00 committed by Justin Clark-Casey (justincc)
parent 914ebd7476
commit b6cbda61b3
2 changed files with 12 additions and 6 deletions

View File

@ -111,11 +111,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
return true; return true;
} }
public JsonStore(string value) public JsonStore()
{ {
m_TakeStore = new List<TakeValueCallbackClass>(); m_TakeStore = new List<TakeValueCallbackClass>();
m_ReadStore = new List<TakeValueCallbackClass>(); m_ReadStore = new List<TakeValueCallbackClass>();
}
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)) if (String.IsNullOrEmpty(value))
ValueStore = new OSDMap(); ValueStore = new OSDMap();
else else
@ -541,14 +547,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
// The path pointed to an intermediate hash structure // The path pointed to an intermediate hash structure
if (result.Type == OSDType.Map) if (result.Type == OSDType.Map)
{ {
value = OSDParser.SerializeJsonString(result as OSDMap); value = OSDParser.SerializeJsonString(result as OSDMap,true);
return true; return true;
} }
// The path pointed to an intermediate hash structure // The path pointed to an intermediate hash structure
if (result.Type == OSDType.Array) if (result.Type == OSDType.Array)
{ {
value = OSDParser.SerializeJsonString(result as OSDArray); value = OSDParser.SerializeJsonString(result as OSDArray,true);
return true; return true;
} }

View File

@ -191,7 +191,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error(string.Format("[JsonStore]: Unable to initialize store from {0}", value), e); m_log.ErrorFormat("[JsonStore]: Unable to initialize store from {0}", value);
return false; return false;
} }