From a5cc49b4d61aaefb9da633632e0a5dfb05733bc1 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 6 Aug 2009 19:37:33 +0000 Subject: [PATCH] Going through ridiculous contortions to prevent OpenMetaverse.StructuredData.dll from crashing on Mono while decoding JSON objects git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3066 52acb1d6-8a22-11de-b505-999d5b087335 --- OpenMetaverse.StructuredData/JSON/OSDJson.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenMetaverse.StructuredData/JSON/OSDJson.cs b/OpenMetaverse.StructuredData/JSON/OSDJson.cs index 4029ae9c..57773cda 100644 --- a/OpenMetaverse.StructuredData/JSON/OSDJson.cs +++ b/OpenMetaverse.StructuredData/JSON/OSDJson.cs @@ -1,5 +1,7 @@ using System; +using System.Collections; using System.Collections.Generic; +using System.Collections.Specialized; using System.IO; using LitJson; @@ -46,8 +48,9 @@ namespace OpenMetaverse.StructuredData return array; case JsonType.Object: OSDMap map = new OSDMap(json.Count); - foreach (KeyValuePair kvp in json) - map.Add(kvp.Key, DeserializeJson(kvp.Value)); + IDictionaryEnumerator e = ((IOrderedDictionary)json).GetEnumerator(); + while (e.MoveNext()) + map.Add((string)e.Key, DeserializeJson((JsonData)e.Value)); return map; case JsonType.None: default: