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; } }
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); }
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); }
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); }
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); }
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); }
public Folder(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public VirtualMachineProvisioningChecker(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public EnvironmentBrowser(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public HostGraphicsManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public HostNetworkSystem(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public VirtualMachineCompatibilityChecker(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
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) { }
public DatastoreNamespaceManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public GuestWindowsRegistryManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public LicenseAssignmentManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public HostFirmwareSystem(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public GuestAuthManager(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public HostActiveDirectoryAuthentication(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
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) { }
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) { }
public HostCpuSchedulerSystem(VimClient client, ManagedObjectReference moRef) : base(client, moRef) { }