Пример #1
0
 public static PackData GetDisksAndVolumes(this IVdsPack pack)
 {
     return(new PackData {
         Disks = pack.GetDisks(),
         Volumes = pack.GetVolumes()
     });
 }
Пример #2
0
        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);
            }
        }
Пример #3
0
 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);
     }
 }
Пример #4
0
        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);
            }
        }
Пример #5
0
 public Pack()
 {
     this.refresh = true;
     this.pack    = null;
 }