예제 #1
0
 private static string ValidatePropertyPath(System.Type viewType, string inputProperty)
 {
     System.Type type      = viewType;
     string[]    strArray1 = inputProperty.Split('.');
     string[]    strArray2 = new string[strArray1.Length];
     for (int index = 0; index < strArray1.Length; ++index)
     {
         PropertyInfo propertyInfo = (PropertyInfo)null;
         if (type != (System.Type)null)
         {
             ViReflectionCache.GetTypeProperties(type).TryGetValue(strArray1[index].ToLower(), out propertyInfo);
         }
         if (propertyInfo != (PropertyInfo)null)
         {
             type             = propertyInfo.PropertyType;
             strArray2[index] = VimClient.MakeCamelCase(propertyInfo.Name);
         }
         else
         {
             strArray2[index] = VimClient.MakeCamelCase(strArray1[index]);
             type             = (System.Type)null;
         }
     }
     return(string.Join(".", strArray2));
 }
        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;
            }
        }
예제 #3
0
 internal static string[] MakePropertiesCamelCase(string[] properties)
 {
     string[] strArray = (string[])null;
     if (properties != null)
     {
         strArray = new string[properties.Length];
         for (int index = 0; index < properties.Length; ++index)
         {
             strArray[index] = VimClient.MakePropertyCamelCase(properties[index]);
         }
     }
     return(strArray);
 }
예제 #4
0
        internal static string MakePropertyCamelCase(string property)
        {
            string str = property;

            if (!string.IsNullOrEmpty(property))
            {
                string[] strArray1 = property.Split('.');
                string[] strArray2 = new string[strArray1.Length];
                for (int index = 0; index < strArray1.Length; ++index)
                {
                    strArray2[index] = VimClient.MakeCamelCase(strArray1[index]);
                }
                str = string.Join(".", strArray2);
            }
            return(str);
        }
예제 #5
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);
        }
예제 #6
0
 public void UpdateViewData(params string[] properties)
 {
     PropertyCollector propertyCollector = new PropertyCollector(this._client, this._client.ServiceContent.PropertyCollector);
     PropertyFilterSpec resultPropertyFilterSpec;
     Dictionary<string, List<string>> currentAllowedPropertyPath;
     DynamicPropertyFilterSpecGenerator.Generate(this.MoRef, VimClient.MakePropertiesCamelCase(properties), out resultPropertyFilterSpec, out currentAllowedPropertyPath);
     PropertyFilterSpec[] specSet = new PropertyFilterSpec[1]
     {
 resultPropertyFilterSpec
     };
     ObjectContent[] objectContentArray = propertyCollector.RetrieveProperties(specSet);
     Dictionary<string, ObjectContent> objectContentList = new Dictionary<string, ObjectContent>();
     foreach (ObjectContent objectContent in objectContentArray)
         objectContentList.Add(objectContent.Obj.Value, objectContent);
     Dictionary<string, ViewBase> generatedManagedObjectList = new Dictionary<string, ViewBase>();
     if (properties != null)
     {
         List<string> stringList = new List<string>((IEnumerable<string>)properties);
     }
     ViewBase.SetViewData(this, (string)null, currentAllowedPropertyPath, objectContentList, generatedManagedObjectList);
 }
예제 #7
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);
        }
예제 #8
0
 public Folder(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #9
0
 public VirtualMachineProvisioningChecker(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
 public EnvironmentBrowser(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #11
0
 public HostGraphicsManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #12
0
 public HostNetworkSystem(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #13
0
 public VirtualMachineCompatibilityChecker(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #14
0
 public OptionManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
 public HostHealthStatusSystem(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
 public UserDirectory(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #17
0
 public DatastoreNamespaceManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
 public GuestWindowsRegistryManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #19
0
 public LicenseAssignmentManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #20
0
 public HostFirmwareSystem(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #21
0
 public GuestAuthManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #22
0
 public HostActiveDirectoryAuthentication(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #23
0
 public ListView(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
 public VcenterVStorageObjectManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
 public HostBootDeviceSystem(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
 public VsanUpgradeSystem(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #27
0
 public VirtualApp(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
 public CustomFieldsManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
 public IpPoolManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
예제 #30
0
 public HostCpuSchedulerSystem(VimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }