Beispiel #1
0
        public static Dictionary <string, object> BuildAssocDictionary(ResultBuffer rb)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);

            TypedValue[]  array = rb.AsArray();
            object        obj   = null;
            List <object> list  = new List <object>();

            TypedValue[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                TypedValue typedValue = array2[i];
                if (typedValue.TypeCode == 5016)
                {
                    list.Clear();
                    obj = null;
                }
                else if (typedValue.TypeCode == 5017)
                {
                    if (obj != null && list.Count > 0)
                    {
                        string key  = obj.ToString();
                        object obj2 = LspUtil.BuildValueFromGroup(list);
                        if (obj2 != null)
                        {
                            dictionary.Add(key, obj2);
                        }
                        list.Clear();
                        obj = null;
                    }
                }
                else if (typedValue.TypeCode == 5018)
                {
                    if (obj != null && list.Count > 0)
                    {
                        string key2 = obj.ToString();
                        object obj3 = LspUtil.BuildValueFromGroup(list);
                        if (obj3 != null)
                        {
                            dictionary.Add(key2, obj3);
                        }
                        list.Clear();
                        obj = null;
                    }
                }
                else if (obj == null)
                {
                    obj = typedValue.Value;
                }
                else
                {
                    list.Add(typedValue.Value);
                }
            }
            if (obj != null && list.Count > 0)
            {
                string key3 = obj.ToString();
                object obj4 = LspUtil.BuildValueFromGroup(list);
                if (obj4 != null)
                {
                    dictionary.Add(key3, obj4);
                }
                list.Clear();
            }
            return(dictionary);
        }