private bool TryToTransformSingleFileSource(SingleFileSource source, FilesList filesList) { if (!transformations.ContainsKey(source.Id)) { return(false); } CopyProcessorTransformation transformation = transformations[source.Id]; if ((transformation.Options & CopyProcessorTransformationOptions.SingleFile) == 0) { return(false); } LocalPath destinationPath = transformation.DestinationPath; PackagedFileInfo sourceFile = source.ListFiles().AsQueryable().First(); FullPath destinationFullPath = destinationRootDir.CombineWith(destinationPath); FileFullPath destinationFileFullPath = destinationFullPath.ToFileFullPath(); filesList.AddFile(new PackagedFileInfo(destinationFileFullPath)); copier.Copy(sourceFile.FileFullPath, destinationFileFullPath); return(true); }
public ICollection <PackagedFileInfo> ListFiles() { List <PackagedFileInfo> files = new List <PackagedFileInfo>(); string directoryPathString = directoryPath.ToString(); int directoryPathStringLength = directoryPathString.Length; if (false == directoryPathString.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal)) { directoryPathStringLength++; } foreach (string fileName in directoryFilesLister.ListFiles(directoryPathString, recursive)) { if (false == fileName.StartsWith( directoryPathString, StringComparison.OrdinalIgnoreCase)) { throw new InvalidOperationException(); } if (false == LoggingHelper.LogIfFilteredOut(fileName, Filter, logger)) { continue; } LocalPath localPath = new LocalPath( fileName.Substring(directoryPathStringLength)); PackagedFileInfo packagedFileInfo = new PackagedFileInfo(new FullPath(fileName), localPath); files.Add(packagedFileInfo); } return(files); }
public ICollection <PackagedFileInfo> ListFiles() { List <PackagedFileInfo> files = new List <PackagedFileInfo>(); foreach (string fileName in directoryFilesLister.ListFiles( directoryPath.ToString(), recursive)) { FileFullPath fileNameFullPath = new FileFullPath(fileName); LocalPath debasedFileName = fileNameFullPath.ToFullPath().DebasePath(directoryPath); if (false == LoggingHelper.LogIfFilteredOut(fileName, Filter, taskContext)) { continue; } PackagedFileInfo packagedFileInfo = new PackagedFileInfo(fileNameFullPath, debasedFileName); files.Add(packagedFileInfo); } return(files); }
public void AddFile(PackagedFileInfo packagedFileInfo) { files.Add(packagedFileInfo); }