Пример #1
0
        /// <summary>
        /// Delete single file
        /// </summary>
        /// <param name="path">fileHash</param>
        /// <returns>true when success</returns>
        public bool FileDelete(string path)
        {
            if (string.IsNullOrEmpty(path) || !ExistFile(path))
            {
                return(false);
            }

            var thumbPath      = CombinePath(path);
            var hostFilesystem = new StorageHostFullPathFilesystem(_logger);

            return(hostFilesystem.FileDelete(thumbPath));
        }
Пример #2
0
        /// <summary>
        /// Returns a list of directories // Get list of child folders
        /// </summary>
        /// <param name="path">subPath in directory</param>
        /// <returns></returns>
        public IEnumerable <string> GetDirectoryRecursive(string path)
        {
            var fullFilePath = _appSettings.DatabasePathToFilePath(path);

            if (fullFilePath == null)
            {
                return(Enumerable.Empty <string>());
            }

            var folders = new StorageHostFullPathFilesystem(_logger).GetDirectoryRecursive(fullFilePath);

            // Used For subfolders
            // convert back to subPath style
            return(_appSettings.RenameListItemsToDbStyle(folders.ToList()));
        }
Пример #3
0
        public void FileCopy(string fromPath, string toPath)
        {
            var oldThumbPath = CombinePath(fromPath);
            var newThumbPath = CombinePath(toPath);

            var hostFilesystem = new StorageHostFullPathFilesystem(_logger);

            var existOldFile = hostFilesystem.ExistFile(oldThumbPath);
            var existNewFile = hostFilesystem.ExistFile(newThumbPath);

            if (!existOldFile || existNewFile)
            {
                return;
            }
            hostFilesystem.FileCopy(oldThumbPath, newThumbPath);
        }
Пример #4
0
        /// <summary>
        /// Returns a list of Files in a directory (non-Recursive)
        /// to filter use:
        /// ..etAllFilesInDirectory(subPath)
        ///	.Where(ExtensionRolesHelper.IsExtensionExifToolSupported)
        /// </summary>
        /// <param name="path">subPath path relative to the database</param>
        /// <returns></returns>
        public IEnumerable <string> GetAllFilesInDirectory(string path)
        {
            var fullFilePath = _appSettings.DatabasePathToFilePath(path);

            // null is not found
            if (fullFilePath == null)
            {
                return(Enumerable.Empty <string>());
            }

            var imageFilesList = new StorageHostFullPathFilesystem(_logger).GetAllFilesInDirectory(fullFilePath);

            // to filter use:
            // ..etAllFilesInDirectory(subPath)
            //	.Where(ExtensionRolesHelper.IsExtensionExifToolSupported)

            // convert back to subPath style
            return(_appSettings.RenameListItemsToDbStyle(imageFilesList.ToList()));
        }