Esempio n. 1
0
        /// <summary>
        /// Copies a file from the virtual machine to the host machine
        /// </summary>
        /// <param name=”sourceFile”>The source file on the virtual machine</param>
        /// <param name=”destinationFile”>The destination on the host machine</param>
        /// <returns>true if succeeded, otherwise false</returns>
        public bool CopyFileFromVm(string sourceFile, string destinationFile)
        {
            //
            // Copy files from host to guest
            //
            IJob jobHandle = m_vmHandle.CopyFileFromGuestToHost(sourceFile, destinationFile,
                                                                0, null, null);

            m_vixError = jobHandle.WaitWithoutResults();

            return(m_vixError == VixCOM.Constants.VIX_OK);
        }
Esempio n. 2
0
        public void CopyFileToHost(string source, string destination)
        {
            VixCOM.IJob job = _virtualMachine.CopyFileFromGuestToHost(source, destination, 0, null, null);
            UInt64      err = job.WaitWithoutResults();

            if (lib.ErrorIndicatesFailure(err))
            {
                short  errCode = lib.ErrorCode(err);
                string errMsg;
                errMsg = lib.GetErrorText(err, null);

                throw new Exception("CopyFileToHost: " + errMsg);
            }
        }