private static void DeserializeDictionary(Tag tag, IDictionary dictionary, System.Type declaredType) { bool flag = tag.Children.Count == 0; if (dictionary == null) { dictionary = ReflectionHelper.Instantiate(declaredType) as IDictionary; } System.Type[] genericArguments = dictionary.GetType().GetGenericArguments(); System.Type type1 = genericArguments[0]; System.Type type2 = genericArguments[1]; if (flag) { foreach (string index in (IEnumerable <string>)tag.Attributes.Keys) { object key = SdlSerializer.DeCoerce((object)index, type1); object obj = SdlSerializer.DeCoerce(tag[index], type2); SdlSerializer.SafeAddToDictionary(dictionary, key, obj); } } else { foreach (Tag tag1 in (IEnumerable <Tag>)tag.Children) { object coerced = tag1["key"]; Tag child = tag1.GetChild("key"); if (!(coerced != null ^ child != null)) { throw new SdlSerializationException(Resources.IllegalCollectionStructure, dictionary.GetType(), tag.Name); } if (coerced != null) { object key = SdlSerializer.DeCoerce(coerced, type1); object obj = SdlSerializer.DeserializeInternal(type2, tag1, (object)null); SdlSerializer.SafeAddToDictionary(dictionary, key, obj); } else { object key = SdlSerializer.DeserializeInternal(type1, child, (object)null); bool simpleType = SdlSerializer.IsCoercible(type2); bool valueFound; object obj = SdlSerializer.DeserializeChild("value", (object)null, type2, simpleType, SdlSerializer.DefaultAttribute, tag1, out valueFound); SdlSerializer.SafeAddToDictionary(dictionary, key, obj); } } } }