コード例 #1
0
        internal static void ProcessArray(JArray obj, AdskDynamicDictionary dict)
        {
            int i = 0;

            foreach (JToken item in obj)
            {
                if (item.GetType() == typeof(JValue))
                {
                    dict.Dictionary [i.ToString()] = ((JValue)item).Value;
                }
                else if (item.GetType() == typeof(JObject))
                {
                    AdskDynamicDictionary subDict = new AdskDynamicDictionary();
                    ProcessObject((JObject)(item), subDict);
                    dict.Dictionary [i.ToString()] = subDict;
                }
                else if (item.GetType() == typeof(JArray))
                {
                    AdskDynamicDictionary subDict = new AdskDynamicDictionary();
                    ProcessArray((JArray)item, subDict);
                    dict.Dictionary [i.ToString()] = subDict;
                }
                i++;
            }
        }
コード例 #2
0
 internal static void ProcessObject(JObject obj, AdskDynamicDictionary dict)
 {
     foreach (KeyValuePair <string, JToken> pair in obj)
     {
         if (pair.Value.GetType() == typeof(JValue))
         {
             dict.Dictionary [pair.Key] = ((JValue)pair.Value).Value;
         }
         else if (pair.Value.GetType() == typeof(JObject))
         {
             AdskDynamicDictionary subDict = new AdskDynamicDictionary();
             ProcessObject((JObject)(pair.Value), subDict);
             dict.Dictionary [pair.Key] = subDict;
         }
         else if (pair.Value.GetType() == typeof(JArray))
         {
             AdskDynamicDictionary subDict = new AdskDynamicDictionary();
             ProcessArray((JArray)(pair.Value), subDict);
             dict.Dictionary [pair.Key] = subDict;
         }
     }
 }