private static DynamicPropertyFilterSpecGenerator.PropertyDefinition[] ParsePropertyPath(string propertyPath)
        {
            List <DynamicPropertyFilterSpecGenerator.PropertyDefinition> list = new List <DynamicPropertyFilterSpecGenerator.PropertyDefinition>();
            int num = propertyPath.IndexOf("*");

            if (num != -1 && num != propertyPath.Length - 1)
            {
                throw new ArgumentException(Resources.WrongWildcardPosition);
            }
            if (!DynamicPropertyFilterSpecGenerator.PROPERTY_PATH_VALIDATION_REGEX.IsMatch(propertyPath))
            {
                throw new ArgumentException(Resources.InvalidPropertyPath);
            }
            foreach (Match match in DynamicPropertyFilterSpecGenerator.PROPERTY_PATH_REGEX.Matches(propertyPath))
            {
                DynamicPropertyFilterSpecGenerator.PropertyDefinition propertyDefinition = new DynamicPropertyFilterSpecGenerator.PropertyDefinition();
                propertyDefinition.VimType = DynamicPropertyFilterSpecGenerator.VimType.Unknown;
                if (match.Groups["type"].Success)
                {
                    propertyDefinition.ObjectType = match.Groups["type"].Captures[0].Value;
                    propertyDefinition.VimType    = DynamicPropertyFilterSpecGenerator.VimType.ManagedObject;
                }
                propertyDefinition.Name = match.Groups["name"].Captures[0].Value;
                list.Add(propertyDefinition);
            }
            return(list.ToArray());
        }
        private static void SetPropertyTypesAndFixCasing(DynamicPropertyFilterSpecGenerator.PropertyDefinition[] propertyPathList, string startingType)
        {
            Type type = DynamicPropertyFilterSpecGenerator.GetType(startingType);
            int  i    = 0;

            while (i < propertyPathList.Length)
            {
                DynamicPropertyFilterSpecGenerator.PropertyDefinition propertyDefinition = propertyPathList[i];
                if (propertyDefinition.Name == "*")
                {
                    break;
                }
                Dictionary <string, PropertyInfo> arg_3F_0 = ViReflectionCache.GetTypeProperties(type);
                PropertyInfo propertyInfo = null;
                arg_3F_0.TryGetValue(propertyDefinition.Name.ToLower(), out propertyInfo);
                if (propertyInfo == null)
                {
                    throw new ArgumentException(string.Format(Resources.PropertyDoesNotExist, propertyDefinition.Name));
                }
                propertyDefinition.Name = VimClient.MakeCamelCase(propertyInfo.Name);
                if (propertyInfo.PropertyType == typeof(ManagedObjectReference) || propertyInfo.PropertyType == typeof(ManagedObjectReference[]))
                {
                    type = DynamicPropertyFilterSpecGenerator.GetType(string.Format("{0}_LinkedView", type.Name));
                    ViReflectionCache.GetTypeProperties(type).TryGetValue(propertyDefinition.Name.ToLower(), out propertyInfo);
                    if (propertyDefinition.VimType != DynamicPropertyFilterSpecGenerator.VimType.ManagedObject)
                    {
                        propertyDefinition.VimType = DynamicPropertyFilterSpecGenerator.VimType.ManagedObject;
                        goto IL_169;
                    }
                    if (!DynamicPropertyFilterSpecGenerator.GetType(DynamicPropertyFilterSpecGenerator.FixTypeName(propertyInfo.PropertyType.Name)).IsAssignableFrom(DynamicPropertyFilterSpecGenerator.GetType(propertyDefinition.ObjectType)))
                    {
                        throw new ArgumentException(string.Format(Resources.WrongPropertyType, propertyDefinition.Name, propertyInfo.PropertyType.Name));
                    }
                    type = DynamicPropertyFilterSpecGenerator.GetType(propertyDefinition.ObjectType);
                }
                else
                {
                    if (propertyDefinition.VimType == DynamicPropertyFilterSpecGenerator.VimType.ManagedObject)
                    {
                        throw new ArgumentException(string.Format(Resources.SpecifiedDataObjectType, propertyDefinition.Name));
                    }
                    propertyDefinition.VimType = DynamicPropertyFilterSpecGenerator.VimType.DataObject;
                    goto IL_169;
                }
IL_18D:
                i++;
                continue;
IL_169:
                type = DynamicPropertyFilterSpecGenerator.GetType(propertyInfo.PropertyType.Name);
                propertyDefinition.ObjectType = propertyInfo.PropertyType.Name;
                goto IL_18D;
            }
        }
        private static void GenerateAllowedPropertyPath(ref Dictionary <string, List <string> > allowedPropertyPath, DynamicPropertyFilterSpecGenerator.PropertyDefinition[] userSpecifiedPropertyList, DynamicPropertyFilterSpecGenerator.PropertyDefinition[] fixedPropertyList)
        {
            string text = "";
            int    num  = userSpecifiedPropertyList.Length;

            for (int i = 0; i < userSpecifiedPropertyList.Length; i++)
            {
                DynamicPropertyFilterSpecGenerator.PropertyDefinition propertyDefinition = (userSpecifiedPropertyList[i].ObjectType != null) ? userSpecifiedPropertyList[i] : fixedPropertyList[i];
                if (propertyDefinition.ObjectType != null)
                {
                    propertyDefinition.ObjectType = DynamicPropertyFilterSpecGenerator.FixTypeName(propertyDefinition.ObjectType);
                }
                text = string.Format("{0}{1}{2}", text, (text != string.Empty) ? "." : "", propertyDefinition.Name.ToLower());
                string text2 = string.Format("{0}->", text);
                if (allowedPropertyPath.ContainsKey(text))
                {
                    if (!allowedPropertyPath[text].Contains(propertyDefinition.ObjectType))
                    {
                        allowedPropertyPath[text].Add(propertyDefinition.ObjectType);
                    }
                }
                else if (allowedPropertyPath.ContainsKey(text2))
                {
                    if (propertyDefinition.ObjectType != null && !allowedPropertyPath[text2].Contains(propertyDefinition.ObjectType))
                    {
                        allowedPropertyPath[text2].Add(propertyDefinition.ObjectType);
                    }
                    if (num == 1)
                    {
                        List <string> value = allowedPropertyPath[text2];
                        allowedPropertyPath.Remove(text2);
                        allowedPropertyPath.Add(text, value);
                    }
                }
                else
                {
                    string key = (num == 1) ? text : text2;
                    allowedPropertyPath[key] = new List <string>();
                    if (propertyDefinition.ObjectType != null)
                    {
                        allowedPropertyPath[key].Add(propertyDefinition.ObjectType);
                    }
                }
                num--;
            }
        }