Пример #1
0
 public Service(IVdsService vdsService) : base(vdsService)
 {
     this.refresh            = true;
     this.queryProviderFlags = QueryProviderFlags.HardwareProviders | QueryProviderFlags.SoftwareProviders;
     this.service            = vdsService;
     base.VdsService         = this.service;
     try
     {
         this.serviceHba = (IVdsServiceHba)vdsService;
     }
     catch (InvalidCastException)
     {
     }
     try
     {
         this.vdsNotificationSink = new AdviseSink(this);
         this.service.Advise(this.vdsNotificationSink, out this.cookie);
     }
     catch (COMException exception)
     {
         throw new VdsException("The call to IVdsService::Advise failed.", exception);
     }
     catch (InvalidCastException exception2)
     {
         throw new VdsException("QueryInterface for IVdsService failed.", exception2);
     }
 }
Пример #2
0
 protected override void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             this.vdsNotificationSink.Dispose();
         }
         try
         {
             if (this.cookie != 0)
             {
                 IVdsService service = InteropHelpers.QueryInterface <IVdsService>(base.ComUnknown);
                 if (service != null)
                 {
                     service.Unadvise(this.cookie);
                 }
                 this.cookie = 0;
             }
         }
         catch (COMException)
         {
         }
         catch (InvalidComObjectException)
         {
         }
         this.disposed = true;
         base.Dispose(disposing);
     }
 }
Пример #3
0
 public static IEnumerable <IVdsVolume> GetVolumes(this IVdsService vdsService)
 {
     foreach (var pack in vdsService.GetPacks())
     {
         IEnumVdsObject volumeEnum;
         pack.QueryVolumes(out volumeEnum);
         object iface;
         int    fetched;
         while (0 == volumeEnum.Next(1, out iface, out fetched))
         {
             yield return(iface as IVdsVolume);
         }
     }
 }
Пример #4
0
        public static IEnumerable <IVdsProvider> GetProviders(this IVdsService vdsService, VdsProviderMask providerMask = VdsProviderMask.Software)
        {
            IEnumVdsObject providerEnum;
            int            hr = vdsService.QueryProviders(providerMask, out providerEnum);

            Marshal.ThrowExceptionForHR(hr);

            object iface;
            int    fetched;

            while (0 == providerEnum.Next(1, out iface, out fetched))
            {
                yield return(iface as IVdsProvider);
            }
        }
Пример #5
0
        public static IEnumerable <IVdsDisk> GetDisks(this IVdsService vdsService)
        {
            foreach (var pack in vdsService.GetPacks())
            {
                IEnumVdsObject diskEnum;
                Marshal.ThrowExceptionForHR(pack.QueryDisks(out diskEnum));
                object iface;
                int    fetched;

                while (0 == diskEnum.Next(1, out iface, out fetched))
                {
                    yield return(iface as IVdsDisk);
                }
            }
        }
Пример #6
0
 public static IEnumerable <IVdsPack> GetPacks(this IVdsService vdsService)
 {
     foreach (var provider in vdsService.GetProviders(VdsProviderMask.Software))
     {
         var swProvider = provider as IVdsSwProvider;
         if (swProvider != null)
         {
             IEnumVdsObject packEnum;
             Marshal.ThrowExceptionForHR(swProvider.QueryPacks(out packEnum));
             object iface;
             int    fetched;
             while (0 == packEnum.Next(1, out iface, out fetched))
             {
                 yield return(iface as IVdsPack);
             }
         }
     }
 }
Пример #7
0
 public override void InitializeComInterfaces()
 {
     base.InitializeComInterfaces();
     if (this.service == null)
     {
         this.service = InteropHelpers.QueryInterface <IVdsService>(base.ComUnknown);
         if (this.service == null)
         {
             throw new VdsException("QueryInterface for IVdsSerivce failed.");
         }
     }
     if (this.serviceHba == null)
     {
         this.serviceHba = InteropHelpers.QueryInterface <IVdsServiceHba>(base.ComUnknown);
     }
     if (this.serviceIscsi == null)
     {
         this.serviceIscsi = InteropHelpers.QueryInterface <IVdsServiceIscsi>(base.ComUnknown);
     }
     if (this.uninstallDisk == null)
     {
         this.uninstallDisk = InteropHelpers.QueryInterface <IVdsServiceUninstallDisk>(base.ComUnknown);
     }
 }
Пример #8
0
 public Drive(object driveUnknown, IVdsService vdsService) : base(driveUnknown, vdsService)
 {
     this.refresh = true;
     this.InitializeComInterfaces();
 }
Пример #9
0
 public Enumerator(IEnumVdsObject vdsEnumerator, IVdsService vdsService)
 {
     this.vdsEnumerator = vdsEnumerator;
     this.vdsService    = vdsService;
 }
Пример #10
0
 public LunPlex(object comUnknown, IVdsService vdsService) : base(comUnknown, vdsService)
 {
     this.refresh = true;
     this.InitializeComInterfaces();
 }
Пример #11
0
 private VdsSession(IVdsService service)
 {
     mService = service;
 }
Пример #12
0
 public Wrapper(object comUnknown, IVdsService vdsService)
 {
     this.comUnknown = comUnknown;
     this.vdsService = vdsService;
 }
Пример #13
0
 public ControllerPort(object comUnknown, IVdsService vdsService) : base(comUnknown, vdsService)
 {
     this.refresh = true;
     this.InitializeComInterfaces();
 }
Пример #14
0
 public SubSystem(object subSystemUnknown, IVdsService vdsService) : base(subSystemUnknown, vdsService)
 {
     this.refresh = true;
     this.InitializeComInterfaces();
 }
Пример #15
0
 public Pack(object lunUnknown, IVdsService vdsService) : base(lunUnknown, vdsService)
 {
     this.refresh = true;
     this.InitializeComInterfaces();
 }
Пример #16
0
 public Provider(object providerUnk, IVdsService vdsService) : base(providerUnk, vdsService)
 {
     this.refresh = true;
     this.InitializeComInterfaces();
 }
Пример #17
0
 protected Wrapper(object comUnknown)
 {
     this.comUnknown = comUnknown;
     this.vdsService = null;
 }
Пример #18
0
 public HardwareProvider(object providerUnk, IVdsService vdsService) : base(providerUnk, vdsService)
 {
     this.InitializeComInterfaces();
 }
Пример #19
0
 public AdvancedDisk(object comUnknown, IVdsService vdsService) : base(comUnknown, vdsService)
 {
     this.InitializeComInterfaces();
 }