コード例 #1
0
 public static void RequiresVersion(IVimClient _client, VimVersion _version)
 {
     if (_client.Version < _version)
     {
         throw new NotSupportedException(string.Format(Resources.MethodNotSupported, _client.ServiceContent.About.ApiVersion));
     }
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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;
     }
 }
コード例 #4
0
 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));
 }
コード例 #5
0
 public HostSystem(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #6
0
 public Datastore(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #7
0
 public HttpNfcLease(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #8
0
 public PropertyCollector(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #9
0
 public ClusterComputeResource(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #10
0
 public VStorageObjectManagerBase(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #11
0
 public HostVirtualNicManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #12
0
 public OverheadMemoryManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #13
0
 public ResourcePlanningManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #14
0
 public StorageResourceManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #15
0
 public Network(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #16
0
 public ExtensionManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #17
0
 public SimpleCommand(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #18
0
 public ClusterProfile(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #19
0
 public DistributedVirtualSwitch(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #20
0
 public ServiceManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #21
0
 public ScheduledTaskManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #22
0
 public CryptoManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #23
0
 public PerformanceManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #24
0
 public ProfileComplianceManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #25
0
 public DistributedVirtualPortgroup(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #26
0
 public SearchIndex(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #27
0
 public ResourcePool(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #28
0
 public HostVFlashManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #29
0
 public AuthorizationManager(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }
コード例 #30
0
 public EventHistoryCollector(IVimClient client, ManagedObjectReference moRef) : base(client, moRef)
 {
 }