diff options
author | onefang | 2019-09-11 16:36:50 +1000 |
---|---|---|
committer | onefang | 2019-09-11 16:36:50 +1000 |
commit | 50cd1ffd32f69228e566f2b0b89f86ea0d9fe489 (patch) | |
tree | 52f2ab0c04f1a5d7d6ac5dc872981b4b156447e7 /OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs | |
parent | Renamed branch to SledjChisl. (diff) | |
parent | Bump to release flavour, build 0. (diff) | |
download | opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.zip opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.gz opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.bz2 opensim-SC_OLD-50cd1ffd32f69228e566f2b0b89f86ea0d9fe489.tar.xz |
Merge branch 'SledjChisl'
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs index c38bb3e..9343aab 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors | 2 | * Copyright (c) Contributors |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
@@ -67,7 +67,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
67 | 67 | ||
68 | protected List<TakeValueCallbackClass> m_TakeStore; | 68 | protected List<TakeValueCallbackClass> m_TakeStore; |
69 | protected List<TakeValueCallbackClass> m_ReadStore; | 69 | protected List<TakeValueCallbackClass> m_ReadStore; |
70 | 70 | ||
71 | // add separators for quoted paths and array references | 71 | // add separators for quoted paths and array references |
72 | protected static Regex m_ParsePassOne = new Regex("({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])"); | 72 | protected static Regex m_ParsePassOne = new Regex("({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])"); |
73 | 73 | ||
@@ -98,10 +98,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
98 | /// </summary> | 98 | /// </summary> |
99 | // ----------------------------------------------------------------- | 99 | // ----------------------------------------------------------------- |
100 | public int StringSpace { get; set; } | 100 | public int StringSpace { get; set; } |
101 | 101 | ||
102 | // ----------------------------------------------------------------- | 102 | // ----------------------------------------------------------------- |
103 | /// <summary> | 103 | /// <summary> |
104 | /// | 104 | /// |
105 | /// </summary> | 105 | /// </summary> |
106 | // ----------------------------------------------------------------- | 106 | // ----------------------------------------------------------------- |
107 | public static bool CanonicalPathExpression(string ipath, out string opath) | 107 | public static bool CanonicalPathExpression(string ipath, out string opath) |
@@ -116,13 +116,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
116 | opath = PathExpressionToKey(path); | 116 | opath = PathExpressionToKey(path); |
117 | return true; | 117 | return true; |
118 | } | 118 | } |
119 | 119 | ||
120 | // ----------------------------------------------------------------- | 120 | // ----------------------------------------------------------------- |
121 | /// <summary> | 121 | /// <summary> |
122 | /// | 122 | /// |
123 | /// </summary> | 123 | /// </summary> |
124 | // ----------------------------------------------------------------- | 124 | // ----------------------------------------------------------------- |
125 | public JsonStore() | 125 | public JsonStore() |
126 | { | 126 | { |
127 | StringSpace = 0; | 127 | StringSpace = 0; |
128 | m_TakeStore = new List<TakeValueCallbackClass>(); | 128 | m_TakeStore = new List<TakeValueCallbackClass>(); |
@@ -132,17 +132,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
132 | public JsonStore(string value) : this() | 132 | public JsonStore(string value) : this() |
133 | { | 133 | { |
134 | // This is going to throw an exception if the value is not | 134 | // This is going to throw an exception if the value is not |
135 | // a valid JSON chunk. Calling routines should catch the | 135 | // a valid JSON chunk. Calling routines should catch the |
136 | // exception and handle it appropriately | 136 | // exception and handle it appropriately |
137 | if (String.IsNullOrEmpty(value)) | 137 | if (String.IsNullOrEmpty(value)) |
138 | ValueStore = new OSDMap(); | 138 | ValueStore = new OSDMap(); |
139 | else | 139 | else |
140 | ValueStore = OSDParser.DeserializeJson(value); | 140 | ValueStore = OSDParser.DeserializeJson(value); |
141 | } | 141 | } |
142 | 142 | ||
143 | // ----------------------------------------------------------------- | 143 | // ----------------------------------------------------------------- |
144 | /// <summary> | 144 | /// <summary> |
145 | /// | 145 | /// |
146 | /// </summary> | 146 | /// </summary> |
147 | // ----------------------------------------------------------------- | 147 | // ----------------------------------------------------------------- |
148 | public JsonStoreNodeType GetNodeType(string expr) | 148 | public JsonStoreNodeType GetNodeType(string expr) |
@@ -150,27 +150,27 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
150 | Stack<string> path; | 150 | Stack<string> path; |
151 | if (! ParsePathExpression(expr,out path)) | 151 | if (! ParsePathExpression(expr,out path)) |
152 | return JsonStoreNodeType.Undefined; | 152 | return JsonStoreNodeType.Undefined; |
153 | 153 | ||
154 | OSD result = ProcessPathExpression(ValueStore,path); | 154 | OSD result = ProcessPathExpression(ValueStore,path); |
155 | 155 | ||
156 | if (result == null) | 156 | if (result == null) |
157 | return JsonStoreNodeType.Undefined; | 157 | return JsonStoreNodeType.Undefined; |
158 | 158 | ||
159 | if (result is OSDMap) | 159 | if (result is OSDMap) |
160 | return JsonStoreNodeType.Object; | 160 | return JsonStoreNodeType.Object; |
161 | 161 | ||
162 | if (result is OSDArray) | 162 | if (result is OSDArray) |
163 | return JsonStoreNodeType.Array; | 163 | return JsonStoreNodeType.Array; |
164 | 164 | ||
165 | if (OSDBaseType(result.Type)) | 165 | if (OSDBaseType(result.Type)) |
166 | return JsonStoreNodeType.Value; | 166 | return JsonStoreNodeType.Value; |
167 | 167 | ||
168 | return JsonStoreNodeType.Undefined; | 168 | return JsonStoreNodeType.Undefined; |
169 | } | 169 | } |
170 | 170 | ||
171 | // ----------------------------------------------------------------- | 171 | // ----------------------------------------------------------------- |
172 | /// <summary> | 172 | /// <summary> |
173 | /// | 173 | /// |
174 | /// </summary> | 174 | /// </summary> |
175 | // ----------------------------------------------------------------- | 175 | // ----------------------------------------------------------------- |
176 | public JsonStoreValueType GetValueType(string expr) | 176 | public JsonStoreValueType GetValueType(string expr) |
@@ -178,18 +178,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
178 | Stack<string> path; | 178 | Stack<string> path; |
179 | if (! ParsePathExpression(expr,out path)) | 179 | if (! ParsePathExpression(expr,out path)) |
180 | return JsonStoreValueType.Undefined; | 180 | return JsonStoreValueType.Undefined; |
181 | 181 | ||
182 | OSD result = ProcessPathExpression(ValueStore,path); | 182 | OSD result = ProcessPathExpression(ValueStore,path); |
183 | 183 | ||
184 | if (result == null) | 184 | if (result == null) |
185 | return JsonStoreValueType.Undefined; | 185 | return JsonStoreValueType.Undefined; |
186 | 186 | ||
187 | if (result is OSDMap) | 187 | if (result is OSDMap) |
188 | return JsonStoreValueType.Undefined; | 188 | return JsonStoreValueType.Undefined; |
189 | 189 | ||
190 | if (result is OSDArray) | 190 | if (result is OSDArray) |
191 | return JsonStoreValueType.Undefined; | 191 | return JsonStoreValueType.Undefined; |
192 | 192 | ||
193 | if (result is OSDBoolean) | 193 | if (result is OSDBoolean) |
194 | return JsonStoreValueType.Boolean; | 194 | return JsonStoreValueType.Boolean; |
195 | 195 | ||
@@ -204,10 +204,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
204 | 204 | ||
205 | return JsonStoreValueType.Undefined; | 205 | return JsonStoreValueType.Undefined; |
206 | } | 206 | } |
207 | 207 | ||
208 | // ----------------------------------------------------------------- | 208 | // ----------------------------------------------------------------- |
209 | /// <summary> | 209 | /// <summary> |
210 | /// | 210 | /// |
211 | /// </summary> | 211 | /// </summary> |
212 | // ----------------------------------------------------------------- | 212 | // ----------------------------------------------------------------- |
213 | public int ArrayLength(string expr) | 213 | public int ArrayLength(string expr) |
@@ -228,7 +228,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
228 | 228 | ||
229 | // ----------------------------------------------------------------- | 229 | // ----------------------------------------------------------------- |
230 | /// <summary> | 230 | /// <summary> |
231 | /// | 231 | /// |
232 | /// </summary> | 232 | /// </summary> |
233 | // ----------------------------------------------------------------- | 233 | // ----------------------------------------------------------------- |
234 | public bool GetValue(string expr, out string value, bool useJson) | 234 | public bool GetValue(string expr, out string value, bool useJson) |
@@ -241,23 +241,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
241 | } | 241 | } |
242 | 242 | ||
243 | OSD result = ProcessPathExpression(ValueStore,path); | 243 | OSD result = ProcessPathExpression(ValueStore,path); |
244 | return ConvertOutputValue(result,out value,useJson); | 244 | return ConvertOutputValue(result,out value,useJson); |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | // ----------------------------------------------------------------- | 248 | // ----------------------------------------------------------------- |
249 | /// <summary> | 249 | /// <summary> |
250 | /// | 250 | /// |
251 | /// </summary> | 251 | /// </summary> |
252 | // ----------------------------------------------------------------- | 252 | // ----------------------------------------------------------------- |
253 | public bool RemoveValue(string expr) | 253 | public bool RemoveValue(string expr) |
254 | { | 254 | { |
255 | return SetValueFromExpression(expr,null); | 255 | return SetValueFromExpression(expr,null); |
256 | } | 256 | } |
257 | 257 | ||
258 | // ----------------------------------------------------------------- | 258 | // ----------------------------------------------------------------- |
259 | /// <summary> | 259 | /// <summary> |
260 | /// | 260 | /// |
261 | /// </summary> | 261 | /// </summary> |
262 | // ----------------------------------------------------------------- | 262 | // ----------------------------------------------------------------- |
263 | public bool SetValue(string expr, string value, bool useJson) | 263 | public bool SetValue(string expr, string value, bool useJson) |
@@ -272,7 +272,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
272 | { | 272 | { |
273 | // There doesn't appear to be a good way to determine if the | 273 | // There doesn't appear to be a good way to determine if the |
274 | // value is valid Json other than to let the parser crash | 274 | // value is valid Json other than to let the parser crash |
275 | try | 275 | try |
276 | { | 276 | { |
277 | ovalue = OSDParser.DeserializeJson(value); | 277 | ovalue = OSDParser.DeserializeJson(value); |
278 | } | 278 | } |
@@ -292,13 +292,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
292 | { | 292 | { |
293 | ovalue = new OSDString(value); | 293 | ovalue = new OSDString(value); |
294 | } | 294 | } |
295 | 295 | ||
296 | return SetValueFromExpression(expr,ovalue); | 296 | return SetValueFromExpression(expr,ovalue); |
297 | } | 297 | } |
298 | 298 | ||
299 | // ----------------------------------------------------------------- | 299 | // ----------------------------------------------------------------- |
300 | /// <summary> | 300 | /// <summary> |
301 | /// | 301 | /// |
302 | /// </summary> | 302 | /// </summary> |
303 | // ----------------------------------------------------------------- | 303 | // ----------------------------------------------------------------- |
304 | public bool TakeValue(string expr, bool useJson, TakeValueCallback cback) | 304 | public bool TakeValue(string expr, bool useJson, TakeValueCallback cback) |
@@ -315,7 +315,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
315 | m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); | 315 | m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); |
316 | return false; | 316 | return false; |
317 | } | 317 | } |
318 | 318 | ||
319 | string value = String.Empty; | 319 | string value = String.Empty; |
320 | if (! ConvertOutputValue(result,out value,useJson)) | 320 | if (! ConvertOutputValue(result,out value,useJson)) |
321 | { | 321 | { |
@@ -332,7 +332,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
332 | 332 | ||
333 | // ----------------------------------------------------------------- | 333 | // ----------------------------------------------------------------- |
334 | /// <summary> | 334 | /// <summary> |
335 | /// | 335 | /// |
336 | /// </summary> | 336 | /// </summary> |
337 | // ----------------------------------------------------------------- | 337 | // ----------------------------------------------------------------- |
338 | public bool ReadValue(string expr, bool useJson, TakeValueCallback cback) | 338 | public bool ReadValue(string expr, bool useJson, TakeValueCallback cback) |
@@ -349,7 +349,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
349 | m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); | 349 | m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); |
350 | return false; | 350 | return false; |
351 | } | 351 | } |
352 | 352 | ||
353 | string value = String.Empty; | 353 | string value = String.Empty; |
354 | if (! ConvertOutputValue(result,out value,useJson)) | 354 | if (! ConvertOutputValue(result,out value,useJson)) |
355 | { | 355 | { |
@@ -362,10 +362,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
362 | 362 | ||
363 | return true; | 363 | return true; |
364 | } | 364 | } |
365 | 365 | ||
366 | // ----------------------------------------------------------------- | 366 | // ----------------------------------------------------------------- |
367 | /// <summary> | 367 | /// <summary> |
368 | /// | 368 | /// |
369 | /// </summary> | 369 | /// </summary> |
370 | // ----------------------------------------------------------------- | 370 | // ----------------------------------------------------------------- |
371 | protected bool SetValueFromExpression(string expr, OSD ovalue) | 371 | protected bool SetValueFromExpression(string expr, OSD ovalue) |
@@ -447,7 +447,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
447 | Match match = hmatches[0]; | 447 | Match match = hmatches[0]; |
448 | GroupCollection groups = match.Groups; | 448 | GroupCollection groups = match.Groups; |
449 | string hkey = groups[1].Value; | 449 | string hkey = groups[1].Value; |
450 | 450 | ||
451 | if (result is OSDMap) | 451 | if (result is OSDMap) |
452 | { | 452 | { |
453 | // this is the assignment case | 453 | // this is the assignment case |
@@ -456,7 +456,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
456 | { | 456 | { |
457 | StringSpace -= ComputeSizeOf(hmap[hkey]); | 457 | StringSpace -= ComputeSizeOf(hmap[hkey]); |
458 | StringSpace += ComputeSizeOf(ovalue); | 458 | StringSpace += ComputeSizeOf(ovalue); |
459 | 459 | ||
460 | hmap[hkey] = ovalue; | 460 | hmap[hkey] = ovalue; |
461 | InvokeNextCallback(pexpr + pkey); | 461 | InvokeNextCallback(pexpr + pkey); |
462 | return true; | 462 | return true; |
@@ -483,13 +483,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
483 | 483 | ||
484 | // ----------------------------------------------------------------- | 484 | // ----------------------------------------------------------------- |
485 | /// <summary> | 485 | /// <summary> |
486 | /// | 486 | /// |
487 | /// </summary> | 487 | /// </summary> |
488 | // ----------------------------------------------------------------- | 488 | // ----------------------------------------------------------------- |
489 | protected bool InvokeNextCallback(string pexpr) | 489 | protected bool InvokeNextCallback(string pexpr) |
490 | { | 490 | { |
491 | // Process all of the reads that match the expression first | 491 | // Process all of the reads that match the expression first |
492 | List<TakeValueCallbackClass> reads = | 492 | List<TakeValueCallbackClass> reads = |
493 | m_ReadStore.FindAll(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); }); | 493 | m_ReadStore.FindAll(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); }); |
494 | 494 | ||
495 | foreach (TakeValueCallbackClass readcb in reads) | 495 | foreach (TakeValueCallbackClass readcb in reads) |
@@ -501,7 +501,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
501 | // Process one take next | 501 | // Process one take next |
502 | TakeValueCallbackClass takecb = | 502 | TakeValueCallbackClass takecb = |
503 | m_TakeStore.Find(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); }); | 503 | m_TakeStore.Find(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); }); |
504 | 504 | ||
505 | if (takecb != null) | 505 | if (takecb != null) |
506 | { | 506 | { |
507 | m_TakeStore.Remove(takecb); | 507 | m_TakeStore.Remove(takecb); |
@@ -525,13 +525,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
525 | 525 | ||
526 | // add front and rear separators | 526 | // add front and rear separators |
527 | expr = "." + expr + "."; | 527 | expr = "." + expr + "."; |
528 | 528 | ||
529 | // add separators for quoted exprs and array references | 529 | // add separators for quoted exprs and array references |
530 | expr = m_ParsePassOne.Replace(expr,".$1.",-1,0); | 530 | expr = m_ParsePassOne.Replace(expr,".$1.",-1,0); |
531 | 531 | ||
532 | // add quotes to bare identifier | 532 | // add quotes to bare identifier |
533 | expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0); | 533 | expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0); |
534 | 534 | ||
535 | // remove extra separators | 535 | // remove extra separators |
536 | expr = m_ParsePassFour.Replace(expr,".",-1,0); | 536 | expr = m_ParsePassFour.Replace(expr,".",-1,0); |
537 | 537 | ||
@@ -550,7 +550,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
550 | 550 | ||
551 | // ----------------------------------------------------------------- | 551 | // ----------------------------------------------------------------- |
552 | /// <summary> | 552 | /// <summary> |
553 | /// | 553 | /// |
554 | /// </summary> | 554 | /// </summary> |
555 | /// <param>path is a stack where the top level of the path is at the bottom of the stack</param> | 555 | /// <param>path is a stack where the top level of the path is at the bottom of the stack</param> |
556 | // ----------------------------------------------------------------- | 556 | // ----------------------------------------------------------------- |
@@ -558,13 +558,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
558 | { | 558 | { |
559 | if (path.Count == 0) | 559 | if (path.Count == 0) |
560 | return map; | 560 | return map; |
561 | 561 | ||
562 | string pkey = path.Pop(); | 562 | string pkey = path.Pop(); |
563 | 563 | ||
564 | OSD rmap = ProcessPathExpression(map,path); | 564 | OSD rmap = ProcessPathExpression(map,path); |
565 | if (rmap == null) | 565 | if (rmap == null) |
566 | return null; | 566 | return null; |
567 | 567 | ||
568 | // ---------- Check for an array index ---------- | 568 | // ---------- Check for an array index ---------- |
569 | MatchCollection amatches = m_SimpleArrayPattern.Matches(pkey,0); | 569 | MatchCollection amatches = m_SimpleArrayPattern.Matches(pkey,0); |
570 | 570 | ||
@@ -582,7 +582,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
582 | GroupCollection groups = match.Groups; | 582 | GroupCollection groups = match.Groups; |
583 | string akey = groups[1].Value; | 583 | string akey = groups[1].Value; |
584 | int aval = Convert.ToInt32(akey); | 584 | int aval = Convert.ToInt32(akey); |
585 | 585 | ||
586 | if (aval < amap.Count) | 586 | if (aval < amap.Count) |
587 | return (OSD) amap[aval]; | 587 | return (OSD) amap[aval]; |
588 | 588 | ||
@@ -599,13 +599,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
599 | m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Map,rmap.Type,pkey); | 599 | m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Map,rmap.Type,pkey); |
600 | return null; | 600 | return null; |
601 | } | 601 | } |
602 | 602 | ||
603 | OSDMap hmap = rmap as OSDMap; | 603 | OSDMap hmap = rmap as OSDMap; |
604 | 604 | ||
605 | Match match = hmatches[0]; | 605 | Match match = hmatches[0]; |
606 | GroupCollection groups = match.Groups; | 606 | GroupCollection groups = match.Groups; |
607 | string hkey = groups[1].Value; | 607 | string hkey = groups[1].Value; |
608 | 608 | ||
609 | if (hmap.ContainsKey(hkey)) | 609 | if (hmap.ContainsKey(hkey)) |
610 | return (OSD) hmap[hkey]; | 610 | return (OSD) hmap[hkey]; |
611 | 611 | ||
@@ -619,13 +619,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
619 | 619 | ||
620 | // ----------------------------------------------------------------- | 620 | // ----------------------------------------------------------------- |
621 | /// <summary> | 621 | /// <summary> |
622 | /// | 622 | /// |
623 | /// </summary> | 623 | /// </summary> |
624 | // ----------------------------------------------------------------- | 624 | // ----------------------------------------------------------------- |
625 | protected static bool ConvertOutputValue(OSD result, out string value, bool useJson) | 625 | protected static bool ConvertOutputValue(OSD result, out string value, bool useJson) |
626 | { | 626 | { |
627 | value = String.Empty; | 627 | value = String.Empty; |
628 | 628 | ||
629 | // If we couldn't process the path | 629 | // If we couldn't process the path |
630 | if (result == null) | 630 | if (result == null) |
631 | return false; | 631 | return false; |
@@ -646,13 +646,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
646 | return true; | 646 | return true; |
647 | } | 647 | } |
648 | 648 | ||
649 | value = "'" + result.AsString() + "'"; | 649 | value = "'" + result.AsString() + "'"; |
650 | return true; | 650 | return true; |
651 | } | 651 | } |
652 | 652 | ||
653 | if (OSDBaseType(result.Type)) | 653 | if (OSDBaseType(result.Type)) |
654 | { | 654 | { |
655 | value = result.AsString(); | 655 | value = result.AsString(); |
656 | return true; | 656 | return true; |
657 | } | 657 | } |
658 | 658 | ||
@@ -661,24 +661,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
661 | 661 | ||
662 | // ----------------------------------------------------------------- | 662 | // ----------------------------------------------------------------- |
663 | /// <summary> | 663 | /// <summary> |
664 | /// | 664 | /// |
665 | /// </summary> | 665 | /// </summary> |
666 | // ----------------------------------------------------------------- | 666 | // ----------------------------------------------------------------- |
667 | protected static string PathExpressionToKey(Stack<string> path) | 667 | protected static string PathExpressionToKey(Stack<string> path) |
668 | { | 668 | { |
669 | if (path.Count == 0) | 669 | if (path.Count == 0) |
670 | return ""; | 670 | return ""; |
671 | 671 | ||
672 | string pkey = ""; | 672 | string pkey = ""; |
673 | foreach (string k in path) | 673 | foreach (string k in path) |
674 | pkey = (pkey == "") ? k : (k + "." + pkey); | 674 | pkey = (pkey == "") ? k : (k + "." + pkey); |
675 | 675 | ||
676 | return pkey; | 676 | return pkey; |
677 | } | 677 | } |
678 | 678 | ||
679 | // ----------------------------------------------------------------- | 679 | // ----------------------------------------------------------------- |
680 | /// <summary> | 680 | /// <summary> |
681 | /// | 681 | /// |
682 | /// </summary> | 682 | /// </summary> |
683 | // ----------------------------------------------------------------- | 683 | // ----------------------------------------------------------------- |
684 | protected static bool OSDBaseType(OSDType type) | 684 | protected static bool OSDBaseType(OSDType type) |
@@ -705,7 +705,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
705 | 705 | ||
706 | // ----------------------------------------------------------------- | 706 | // ----------------------------------------------------------------- |
707 | /// <summary> | 707 | /// <summary> |
708 | /// | 708 | /// |
709 | /// </summary> | 709 | /// </summary> |
710 | // ----------------------------------------------------------------- | 710 | // ----------------------------------------------------------------- |
711 | protected static int ComputeSizeOf(OSD value) | 711 | protected static int ComputeSizeOf(OSD value) |
@@ -731,7 +731,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
731 | private Scene m_scene; | 731 | private Scene m_scene; |
732 | private UUID m_objectID; | 732 | private UUID m_objectID; |
733 | 733 | ||
734 | protected override OSD ValueStore | 734 | protected override OSD ValueStore |
735 | { | 735 | { |
736 | get | 736 | get |
737 | { | 737 | { |
@@ -741,7 +741,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
741 | // This is bad | 741 | // This is bad |
742 | return null; | 742 | return null; |
743 | } | 743 | } |
744 | 744 | ||
745 | return sop.DynAttrs.TopLevelMap; | 745 | return sop.DynAttrs.TopLevelMap; |
746 | } | 746 | } |
747 | 747 | ||
@@ -761,5 +761,5 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
761 | StringSpace = ComputeSizeOf(ValueStore); | 761 | StringSpace = ComputeSizeOf(ValueStore); |
762 | } | 762 | } |
763 | } | 763 | } |
764 | 764 | ||
765 | } | 765 | } |