public FolderContentWrapperHelper( FileWrapperHelper fileWrapperHelper, FolderWrapperHelper folderWrapperHelper) { FileWrapperHelper = fileWrapperHelper; FolderWrapperHelper = folderWrapperHelper; }
public FileOperationWraperHelper( FolderWrapperHelper folderWrapperHelper, FileWrapperHelper filesWrapperHelper, IDaoFactory daoFactory, CommonLinkUtility commonLinkUtility) { FolderWrapperHelper = folderWrapperHelper; FilesWrapperHelper = filesWrapperHelper; DaoFactory = daoFactory; CommonLinkUtility = commonLinkUtility; }
public FolderContentWrapperHelper( FileSecurity fileSecurity, IDaoFactory daoFactory, FileWrapperHelper fileWrapperHelper, FolderWrapperHelper folderWrapperHelper) { FileSecurity = fileSecurity; DaoFactory = daoFactory; FileWrapperHelper = fileWrapperHelper; FolderWrapperHelper = folderWrapperHelper; }
public FileOperationWraper Get(FileOperationResult o) { var result = new FileOperationWraper { Id = o.Id, OperationType = o.OperationType, Progress = o.Progress, Error = o.Error, Processed = o.Processed, Finished = o.Finished }; if (!string.IsNullOrEmpty(o.Result) && result.OperationType != FileOperationType.Delete) { var arr = o.Result.Split(':'); var folders = arr .Where(s => s.StartsWith("folder_")) .Select(s => s.Substring(7)); if (folders.Any()) { var fInt = new List <int>(); var fString = new List <string>(); foreach (var folder in folders) { if (int.TryParse(folder, out var f)) { fInt.Add(f); } else { fString.Add(folder); } } result.Folders = GetFolders(folders).ToList(); result.Folders.AddRange(GetFolders(fInt)); } var files = arr .Where(s => s.StartsWith("file_")) .Select(s => s.Substring(5)); if (files.Any()) { var fInt = new List <int>(); var fString = new List <string>(); foreach (var file in files) { if (int.TryParse(file, out var f)) { fInt.Add(f); } else { fString.Add(file); } } result.Files = GetFiles(fString).ToList(); result.Files.AddRange(GetFiles(fInt)); } if (result.OperationType == FileOperationType.Download) { result.Url = CommonLinkUtility.GetFullAbsolutePath(o.Result); } } return(result); IEnumerable <FileEntryWrapper> GetFolders <T>(IEnumerable <T> folders) { var folderDao = DaoFactory.GetFolderDao <T>(); return(folderDao.GetFolders(folders) .Select(r => FolderWrapperHelper.Get(r)) .Cast <FileEntryWrapper>()); } IEnumerable <FileEntryWrapper> GetFiles <T>(IEnumerable <T> files) { var fileDao = DaoFactory.GetFileDao <T>(); return(fileDao.GetFiles(files) .Select(r => FilesWrapperHelper.Get(r)) .Cast <FileEntryWrapper>()); } }