/// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override bool Execute()
        {
            using (VMWareVirtualHost host = GetConnectedHost())
            {
                using (VMWareVirtualMachine virtualMachine = OpenVirtualMachine(host))
                {
                    LoginGuest(virtualMachine);
                    Log.LogMessage(string.Format("Retreiving file information for '{0}' from guest os", _guestPathName));
                    _fileInfo = virtualMachine.GetFileInfoInGuest(_guestPathName, _getFileInfoTimeout);
                }
            }

            return(true);
        }
Beispiel #2
0
 public void TestGetFolderInfoInGuest()
 {
     foreach (VMWareVirtualMachine virtualMachine in _test.PoweredVirtualMachines)
     {
         string tmpPath = virtualMachine.GuestEnvironmentVariables["tmp"];
         VMWareVirtualMachine.GuestFileInfo tmpPathInfo = virtualMachine.GetFileInfoInGuest(tmpPath);
         ConsoleOutput.WriteLine("{0}: {1}, {2} byte(s)",
                                 tmpPathInfo.GuestPathName,
                                 tmpPathInfo.LastModified,
                                 tmpPathInfo.FileSize);
         Assert.AreEqual(0, tmpPathInfo.FileSize);
         Assert.AreEqual(tmpPath, tmpPathInfo.GuestPathName);
         Assert.AreEqual(true, tmpPathInfo.IsDirectory);
         Assert.AreEqual(false, tmpPathInfo.IsSymLink);
         Assert.IsTrue(tmpPathInfo.LastModified > DateTime.MinValue);
     }
 }
Beispiel #3
0
 public void TestGetFileInfoInGuest()
 {
     foreach (VMWareVirtualMachine virtualMachine in _test.PoweredVirtualMachines)
     {
         string hostTmpFilename = Path.GetTempFileName();
         File.WriteAllText(hostTmpFilename, Guid.NewGuid().ToString());
         FileInfo hostTmpFileInfo  = new FileInfo(hostTmpFilename);
         string   guestTmpFilename = virtualMachine.CreateTempFileInGuest();
         DateTime dtBeforeCopy     = DateTime.Now;
         virtualMachine.CopyFileFromHostToGuest(hostTmpFilename, guestTmpFilename);
         VMWareVirtualMachine.GuestFileInfo tmpPathInfo = virtualMachine.GetFileInfoInGuest(guestTmpFilename);
         ConsoleOutput.WriteLine("{0}: {1}, {2} byte(s)",
                                 tmpPathInfo.GuestPathName,
                                 tmpPathInfo.LastModified,
                                 tmpPathInfo.FileSize);
         Assert.AreEqual(hostTmpFileInfo.Length, tmpPathInfo.FileSize);
         Assert.AreEqual(guestTmpFilename, tmpPathInfo.GuestPathName);
         Assert.AreEqual(false, tmpPathInfo.IsDirectory);
         Assert.AreEqual(false, tmpPathInfo.IsSymLink);
         Assert.IsTrue(tmpPathInfo.LastModified >= dtBeforeCopy);
         virtualMachine.DeleteFileFromGuest(guestTmpFilename);
         File.Delete(hostTmpFilename);
     }
 }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override bool Execute()
        {
            using (VMWareVirtualHost host = GetConnectedHost())
            {
                using (VMWareVirtualMachine virtualMachine = OpenVirtualMachine(host))
                {
                    LoginGuest(virtualMachine);
                    Log.LogMessage(string.Format("Retreiving file information for '{0}' from guest os", _guestPathName));
                    _fileInfo = virtualMachine.GetFileInfoInGuest(_guestPathName, _getFileInfoTimeout);
                }
            }

            return true;
        }