Пример #1
0
        public void CreateDirectory(string name)
        {
            VixCOM.IJob job = _virtualMachine.CreateDirectoryInGuest(name, 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("CreateDirectory: " + errMsg);
            }
        }
Пример #2
0
        private void WaitForToolsInGuest()
        {
            VixCOM.IJob job = _virtualMachine.WaitForToolsInGuest(0, null);
            UInt64      err = job.WaitWithoutResults();

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

                throw new Exception("WaitForToolsInGuest: " + errMsg);
            }
        }
Пример #3
0
        public void LoginInGuest(string username, string password)
        {
            VixCOM.IJob job = _virtualMachine.LoginInGuest(username, password, 0, null);
            UInt64      err = job.WaitWithoutResults();

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

                throw new Exception("LoginInGuest: " + errMsg);
            }
        }
Пример #4
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);
            }
        }
Пример #5
0
        public void PowerOff()
        {
            VixCOM.IJob job = _virtualMachine.PowerOff(0, null);
            UInt64      err = job.WaitWithoutResults();

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

                throw new Exception("PowerOff: " + errMsg);
            }
        }
Пример #6
0
        public void RunProgramInGuest(string fullPath, string param)
        {
            VixCOM.IJob job = _virtualMachine.RunProgramInGuest(fullPath, param, 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("RunProgramInGuest: " + errMsg);
            }
        }
Пример #7
0
        public void RevertToSnapshot(string snapshotName)
        {
            VixCOM.ISnapshot snapshot;
            _virtualMachine.GetNamedSnapshot(snapshotName, out snapshot);

            VixCOM.IJob job = _virtualMachine.RevertToSnapshot(snapshot, 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("RevertToSnapshot: " + errMsg);
            }

            WaitForToolsInGuest();
        }