public static File GetFile(IDrive drive, string filePath, string fileName) { FileSystemItem fileSystemItem = drive.GetItemFromPath(filePath + "\\" + fileName); Assert.IsNotNull(fileSystemItem); Assert.AreEqual(fileName, fileSystemItem.Name); Assert.IsFalse(fileSystemItem.IsDirectory()); return((File)fileSystemItem); }
public static Directory GetDirectory(IDrive drive, string directoryPath, string directoryName) { FileSystemItem fileSystemItem = drive.GetItemFromPath(directoryPath); Assert.IsNotNull(fileSystemItem); Assert.AreEqual(directoryName, fileSystemItem.Name); Assert.IsTrue(fileSystemItem.IsDirectory()); return((Directory)fileSystemItem); }
private static Directory ExtractAndCheckIfValidDirectory(string destinationDirectoryName, IDrive drive, IOutputter outputter) { FileSystemItem tempDestinationDirectory = drive.GetItemFromPath(destinationDirectoryName); if (tempDestinationDirectory == null) { outputter.PrintLine(SYSTEM_CANNOT_FIND_THE_PATH_SPECIFIED); return(null); } if (!tempDestinationDirectory.IsDirectory()) { outputter.PrintLine(DESTINATION_IS_FILE); return(null); } return((Directory)tempDestinationDirectory); }
public static Directory ExtractAndCheckIfValidDirectory(string destinationDirectoryName, IDrive drive, IOutputter outputter) { FileSystemItem tempDestinationDirectory = drive.GetItemFromPath(destinationDirectoryName); if (tempDestinationDirectory == null) { outputter.PrintLine(NO_IS_FILE + destinationDirectoryName); return(null); } if (!tempDestinationDirectory.IsDirectory()) { outputter.PrintLine(DESTINATION_IS_FILE); return(null); } return((Directory)tempDestinationDirectory); }
public static Directory ExtractAndCheckIfValidDirectory(string destinationDirectoryName, IDrive drive, IOutputter outputter) { FileSystemItem tempDestinationDirectory = drive.GetItemFromPath(destinationDirectoryName); if (tempDestinationDirectory == null) { outputter.PrintLine(NO_IS_FILE + drive + "\\" + destinationDirectoryName); return(null); } //jika subdirektori tidak ingin dihapus //if (tempDestinationDirectory.IsDirectory()) //{ //outputter.PrintLine(NO_IS_FILE + drive + "\\" + destinationDirectoryName); //return null; //} return(tempDestinationDirectory.Parent); }