public static void RequiresVersion(IVimClient _client, VimVersion _version) { if (_client.Version < _version) { throw new NotSupportedException(string.Format(Resources.MethodNotSupported, _client.ServiceContent.About.ApiVersion)); } }
public ViewBase(IVimClient client, ManagedObjectReference moRef) { if (moRef == null) throw new ArgumentNullException("moRef"); if (client == null) throw new ArgumentNullException("client"); this._client = client; this._moRef = moRef; }
private static void ClearViewData(ViewBase currentObject, string currentPath, List<string> properties) { properties = ViewBase.GetCurrentProperties(currentPath, properties); if (properties.Count > 0) { foreach (string property in properties) { string[] strArray = property.Split('.'); Type type = currentObject.GetType(); object obj1 = (object)currentObject; bool flag = false; for (int index = 0; index < strArray.Length - 1; ++index) { string name = "_" + strArray[index]; FieldInfo field = type.GetTypeInfo().GetField(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.NonPublic); if (field != (FieldInfo)null) { if (field.FieldType == typeof(ManagedObjectReference) && index <= strArray.Length - 2) ViewBase.ClearExtView(obj1); object obj2 = field.GetValue(obj1); type = field.FieldType; if (obj2 == null) { flag = true; break; } obj1 = obj2; } } if (!flag) { FieldInfo field = type.GetField("_" + strArray[strArray.Length - 1], BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.NonPublic); if (field != (FieldInfo)null) ViewBase.ClearField(obj1, field); } } } else { ManagedObjectReference moRef = currentObject._moRef; IVimClient client = currentObject._client; foreach (FieldInfo field in currentObject.GetType().GetTypeInfo().GetFields(BindingFlags.Instance | BindingFlags.NonPublic)) ViewBase.ClearField((object)currentObject, field); currentObject._moRef = moRef; currentObject._client = client; } }
private static void SetExtView(object currentObject, string moPropertyName, IVimClient client, ManagedObjectReference[] moList, Dictionary<string, ObjectContent> objectContentList, Dictionary<string, ViewBase> generatedManagedObjectList, string currentPropertyPath, Dictionary<string, List<string>> allowedPropertyPath) { ArrayList arrayList = new ArrayList(); bool flag = false; if (moList.Length == 0) flag = true; FieldInfo field1 = currentObject.GetType().GetTypeInfo().GetField("_linkedView", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<string, PropertyInfo> typeProperties = ViReflectionCache.GetTypeProperties(currentObject.GetType()); PropertyInfo propertyInfo = (PropertyInfo)null; string lower = "LinkedView".ToLower(); typeProperties.TryGetValue(lower, out propertyInfo); FieldInfo field2 = propertyInfo.PropertyType.GetField(moPropertyName, BindingFlags.Instance | BindingFlags.NonPublic); bool isArray = field2.FieldType.IsArray; Type type = isArray ? field2.FieldType.GetElementType() : field2.FieldType; foreach (ManagedObjectReference mo in moList) { if (objectContentList.ContainsKey(mo.Value) || generatedManagedObjectList.ContainsKey(mo.Value)) { object obj; if (generatedManagedObjectList.ContainsKey(mo.Value)) obj = (object)generatedManagedObjectList[mo.Value]; else obj = ViewBase.GetViewType(mo.Type).GetConstructor(new Type[2] { typeof (IVimClient), typeof (ManagedObjectReference) }).Invoke(new object[2] { (object) client, (object) mo }); ViewBase.SetViewData((ViewBase)obj, currentPropertyPath, allowedPropertyPath, objectContentList, generatedManagedObjectList); arrayList.Add(obj); } } if (!flag && arrayList.Count <= 0) return; object obj1 = propertyInfo.GetValue(currentObject, (object[])null) ?? ViReflectionCache.GetTypeDefaultConstructor(propertyInfo.PropertyType).Invoke((object[])null); field1.SetValue(currentObject, obj1); if (!isArray) field2.SetValue(obj1, arrayList[0]); else field2.SetValue(obj1, (object)arrayList.ToArray(type)); }
public HostSystem(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public Datastore(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public HttpNfcLease(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public PropertyCollector(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public ClusterComputeResource(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public VStorageObjectManagerBase(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public HostVirtualNicManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public OverheadMemoryManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public ResourcePlanningManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public StorageResourceManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public Network(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public ExtensionManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public SimpleCommand(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public ClusterProfile(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public DistributedVirtualSwitch(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public ServiceManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public ScheduledTaskManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public CryptoManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public PerformanceManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public ProfileComplianceManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public DistributedVirtualPortgroup(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public SearchIndex(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public ResourcePool(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public HostVFlashManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public AuthorizationManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }
public EventHistoryCollector(IVimClient client, ManagedObjectReference moRef) : base(client, moRef) { }