Exemplo n.º 1
0
        public VMControllerByAPI(VMWareInfo.VMCoreTypes type)
        {
            try
            {
                _api = new VixLibClass();
            }
            catch (System.Runtime.InteropServices.COMException e)
            {
                throw new VMXServiceException(
                          "Unable to find Vix library!\n" + e.ToString());
            }

            int  core = GetVIXServiceProviderByType(type);
            IJob job  = _api.Connect(
                Constants.VIX_API_VERSION,
                core,
                null, 0, null, null, 0, null, null);

            _host = GetResult <IHost>(WaitForResults(job));
            if (_host == null)
            {
                throw new VMXServiceException("Connecting to VMWare provider was failed.");
            }

            CloseVixObject(job);
        }
Exemplo n.º 2
0
 void IDisposable.Dispose()
 {
     if (_api != null)
     {
         CloseVixObject(_api);
         _api = null;
     }
 }