public void OpenVM(string path) { object results = null; VixCOM.IJob job = _vmwareHost.OpenVM(path, null); UInt64 err = job.Wait(new int[] { VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE }, ref results); if (lib.ErrorIndicatesFailure(err)) { short errCode = lib.ErrorCode(err); string errMsg; errMsg = lib.GetErrorText(err, null); throw new Exception("OpenVM:" + errMsg); } _virtualMachine = (VixCOM.IVM)((object[])results)[0]; }
/// <summary> /// Opens the virtual machine specified in vmxFilePath /// </summary> /// <param name=”vmxFilePath”>The virtual machine vmx file to open</param> /// <returns>true if succeeded, otherwise false</returns> public bool Open(string vmxFilePath) { IJob jobHandle = m_hostHandle.OpenVM(vmxFilePath, null); int[] propertyIds = new int[1] { VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE }; object results = new object(); m_vixError = jobHandle.Wait(propertyIds, ref results); if (m_vixError == VixCOM.Constants.VIX_OK) { object[] objectArray = (object[])results; m_vmHandle = (VixCOM.IVM)objectArray[0]; return(true); } return(false); }
/// <summary> /// Opens the virtual machine specified in vmxFilePath /// </summary> /// <param name=”vmxFilePath”>The virtual machine vmx file to open</param> /// <returns>true if succeeded, otherwise false</returns> public bool Open(string vmxFilePath) { IJob jobHandle = m_hostHandle.OpenVM(vmxFilePath, null); int[] propertyIds = new int[1] { VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_HANDLE }; object results = new object(); m_vixError = jobHandle.Wait(propertyIds, ref results); if(m_vixError == VixCOM.Constants.VIX_OK) { object[] objectArray = (object[])results; m_vmHandle = (VixCOM.IVM)objectArray[0]; return true; } return false; }
public VMware() { lib = new VixCOM.VixLibClass(); _virtualMachine = null; }