public static PackData GetDisksAndVolumes(this IVdsPack pack) { return(new PackData { Disks = pack.GetDisks(), Volumes = pack.GetVolumes() }); }
public static IEnumerable <IVdsVolume> GetVolumes(this IVdsPack pack) { IEnumVdsObject volumeEnum; Marshal.ThrowExceptionForHR(pack.QueryVolumes(out volumeEnum)); object iface; int fetched; while (0 == volumeEnum.Next(1, out iface, out fetched)) { yield return(iface as IVdsVolume); } }
public override void InitializeComInterfaces() { base.InitializeComInterfaces(); try { if (this.pack == null) { this.pack = (IVdsPack)base.ComUnknown; } } catch (InvalidCastException exception) { throw new VdsException("QueryInterface for IVdsPack failed.", exception); } }
public static IEnumerable <IVdsDisk> GetDisks(this IVdsPack pack) { IEnumVdsObject diskEnum; Marshal.ThrowExceptionForHR(pack.QueryDisks(out diskEnum)); object iface; int fetched; var disks = new List <IVdsDisk>(); while (0 == diskEnum.Next(1, out iface, out fetched)) { yield return(iface as IVdsDisk); } }
public Pack() { this.refresh = true; this.pack = null; }