public VirtualDisk(long diskSize, BusType busType, BusSubType busSubType) : base(new RASD_Type()) { cimString cimString1 = new cimString(); List <XmlAttribute> xmlAttributeList = new List <XmlAttribute>(); XmlDocument xmlDocument = new XmlDocument(); if (busType.Value().Equals(BusType.IDE.Value())) { XmlAttribute attribute = xmlDocument.CreateAttribute("vcloud", nameof(busType), "http://www.vmware.com/vcloud/v1.5"); attribute.Value = "5"; xmlAttributeList.Add(attribute); } else { XmlAttribute attribute1 = xmlDocument.CreateAttribute("vcloud", nameof(busSubType), "http://www.vmware.com/vcloud/v1.5"); attribute1.Value = busSubType.Value(); XmlAttribute attribute2 = xmlDocument.CreateAttribute("vcloud", nameof(busType), "http://www.vmware.com/vcloud/v1.5"); attribute2.Value = "6"; xmlAttributeList.Add(attribute1); xmlAttributeList.Add(attribute2); } XmlAttribute attribute3 = xmlDocument.CreateAttribute("vcloud", "capacity", "http://www.vmware.com/vcloud/v1.5"); attribute3.Value = diskSize.ToString(); xmlAttributeList.Add(attribute3); if (cimString1.AnyAttr == null) { cimString1.AnyAttr = xmlAttributeList.ToArray(); } else { List <XmlAttribute> list = ((IEnumerable <XmlAttribute>)cimString1.AnyAttr).ToList <XmlAttribute>(); list.AddRange((IEnumerable <XmlAttribute>)xmlAttributeList); cimString1.AnyAttr = list.ToArray(); } cimString cimString2 = new cimString(); cimString2.Value = ""; cimString cimString3 = new cimString(); cimString3.Value = ""; ResourceType1 resourceType1 = new ResourceType1(); resourceType1.Value = "17"; RASD_Type itemResource = this.GetItemResource(); itemResource.ElementName = cimString2; itemResource.InstanceID = cimString3; itemResource.ResourceType = resourceType1; itemResource.HostResource = new cimString[1] { cimString1 }; }
public BusSubType GetBusSub() { return(BusSubType.FromValue(this.Resource.busSubType)); }