示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
文件: FilesList.cs 项目: breki/flubu
 public void AddFile(PackagedFileInfo packagedFileInfo)
 {
     files.Add(packagedFileInfo);
 }