/// <summary> /// Сopy the directory with the embedded files and directories /// </summary> /// <param name="sourcePath">Path to the source directory</param> /// <param name="destinationPath">Path to the destination directory</param> protected virtual void CopyDirectory(string sourcePath, string destinationPath) { string[] existingFiles = _fileProvider.GetFiles(sourcePath); string[] existingDirectories = _fileProvider.GetDirectories(sourcePath); if (!_fileProvider.DirectoryExists(destinationPath)) { _fileProvider.CreateDirectory(destinationPath); } foreach (string file in existingFiles) { string filePath = _fileProvider.Combine(destinationPath, _fileProvider.GetFileName(file)); if (!_fileProvider.FileExists(filePath)) { _fileProvider.FileCopy(file, filePath); } } foreach (string directory in existingDirectories) { string directoryPath = _fileProvider.Combine(destinationPath, _fileProvider.GetDirectoryName(directory)); CopyDirectory(directory, directoryPath); } }
/// <summary> /// Get picture (thumb) local path /// </summary> /// <param name="thumbFileName">Filename</param> /// <returns>Local picture thumb path</returns> protected virtual string GetThumbLocalPath(string thumbFileName) { string thumbsDirectoryPath = _fileProvider.GetAbsolutePath(AgsMediaDefaults.ImageThumbsPath); if (_mediaSettings.MultipleThumbDirectories) { //get the first two letters of the file name string fileNameWithoutExtension = _fileProvider.GetFileNameWithoutExtension(thumbFileName); if (fileNameWithoutExtension != null && fileNameWithoutExtension.Length > AgsMediaDefaults.MultipleThumbDirectoriesLength) { string subDirectoryName = fileNameWithoutExtension.Substring(0, AgsMediaDefaults.MultipleThumbDirectoriesLength); thumbsDirectoryPath = _fileProvider.GetAbsolutePath(AgsMediaDefaults.ImageThumbsPath, subDirectoryName); _fileProvider.CreateDirectory(thumbsDirectoryPath); } } string thumbFilePath = _fileProvider.Combine(thumbsDirectoryPath, thumbFileName); return(thumbFilePath); }