public VHDInfo GetBaseCfg() { VHDInfo vhdInfo; try { vhdInfo = this.GetCfg(); while (!string.IsNullOrEmpty(vhdInfo.ParentPath)) { using (IVirtualDisk virtualDisk = (IVirtualDisk) new VirtualDisk(this._Host, vhdInfo.ParentPath, this._Logger)) vhdInfo = virtualDisk.GetCfg(); } } catch (Exception ex) { vhdInfo = new VHDInfo(); this._Logger.FormatErrorWithException(ex, "Failed to get the base vhd cfg information due to exception: "); } return(vhdInfo); }
public VHDInfo GetCfg() { VHDInfo vhdInfo = new VHDInfo(); vhdInfo.Path = this._filePath; XElement xelement = XElement.Parse(this._text); long num1 = xelement.Elements((XName)"PROPERTY").Where <XElement>((Func <XElement, bool>)(c => c.Attribute((XName)"NAME").Value == "FileSize")).Select <XElement, long>((Func <XElement, long>)(c => Convert.ToInt64(c.Value))).First <long>(); vhdInfo.FileSize = num1; xelement.Elements((XName)"PROPERTY").Where <XElement>((Func <XElement, bool>)(c => c.Attribute((XName)"NAME").Value == "InUse")).Select <XElement, bool>((Func <XElement, bool>)(c => Convert.ToBoolean(c.Value))).First <bool>(); long num2 = xelement.Elements((XName)"PROPERTY").Where <XElement>((Func <XElement, bool>)(c => c.Attribute((XName)"NAME").Value == "MaxInternalSize")).Select <XElement, long>((Func <XElement, long>)(c => Convert.ToInt64(c.Value))).First <long>(); vhdInfo.MaxInternalSize = num2; string str = xelement.Elements((XName)"PROPERTY").Where <XElement>((Func <XElement, bool>)(c => c.Attribute((XName)"NAME").Value == "ParentPath")).Select <XElement, string>((Func <XElement, string>)(c => c.Value)).First <string>(); vhdInfo.ParentPath = string.IsNullOrEmpty(str) ? (string)null : str; ushort num3 = xelement.Elements((XName)"PROPERTY").Where <XElement>((Func <XElement, bool>)(c => c.Attribute((XName)"NAME").Value == "Type")).Select <XElement, ushort>((Func <XElement, ushort>)(c => Convert.ToUInt16(c.Value))).First <ushort>(); vhdInfo.Type = (int)num3; return(vhdInfo); }