Пример #1
0
        private static string[] ValidatePropertyPathList(System.Type viewType, string[] propertyList)
        {
            List <string> stringList = new List <string>();

            if (propertyList != null && propertyList.Length != 0)
            {
                foreach (string property in propertyList)
                {
                    string str = VimClient.ValidatePropertyPath(viewType, property);
                    stringList.Add(str);
                }
            }
            if (stringList.Count != 0)
            {
                return(stringList.ToArray());
            }
            return((string[])null);
        }
Пример #2
0
        private static bool MatchProperyList(NameValueCollection filter, System.Type viewType, IDictionary <string, object> propList)
        {
            bool flag1 = true;

            foreach (string key1 in filter.Keys)
            {
                string key2 = VimClient.ValidatePropertyPath(viewType, key1);
                if (propList.ContainsKey(key2))
                {
                    string pattern = filter[key2];
                    if (propList[key2] is ManagedObjectReference[])
                    {
                        bool flag2 = false;
                        foreach (ManagedObjectReference managedObjectReference in (ManagedObjectReference[])propList[key2])
                        {
                            Match match = Regex.Match(managedObjectReference.Value, pattern, RegexOptions.IgnoreCase);
                            flag2 = flag2 || match.Success;
                        }
                        if (!flag2)
                        {
                            flag1 = false;
                            break;
                        }
                    }
                    else if (!Regex.Match(!(propList[key2] is ManagedObjectReference) ? (!(propList[key2] is string[]) ? propList[key2].ToString() : string.Join(",", propList[key2] as string[])) : ((ManagedObjectReference)propList[key2]).Value, pattern, RegexOptions.IgnoreCase).Success)
                    {
                        flag1 = false;
                        break;
                    }
                }
                else
                {
                    flag1 = false;
                    break;
                }
            }
            return(flag1);
        }