public static IEnumerable <IFile> FilterOutFilesThatAreToBeExcluded(this IEnumerable <IFile> sourceFiles, IFileSystem fileSystem, DirectoryMapping mapping) { var filesCannotCopy = sourceFiles .Where(x => mapping.Exclusions.Any(y => x.GetFileName().EndsWith(y))); filesCannotCopy.ToList().ForEach(x => LOG.Info($"Not backing up file because it is part of an exclusion: {x.GetFileName()}")); return(sourceFiles.Except(filesCannotCopy)); }
public FileCopySet(int left, int top, DirectoryMapping mapping, IFileSystem fileSystem) { InitializeComponent(); Top = top; Left = left; Mapping = mapping; lblStatus.Text = "Ready"; lnkSource.Text = $"From computer: {mapping.Src}"; lnkSource.Click += LnkSource_Click; lnkDest.Text = $"To destination: {mapping.Dest}"; lnkDest.Click += LnkDest_Click; lblName.Text = mapping.Name; _copyWorker.DoWork += Worker_DoWork; _copyWorker.RunWorkerCompleted += Worker_RunWorkerCompleted; _copyProgressWorker.DoWork += ProgressWorker_DoWork; _copier = new Copier(mapping, fileSystem); }
public Copier(DirectoryMapping mapping, IFileSystem fileSys) { _mapping = mapping; _fileSystem = fileSys; }