Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }