public virtual void Execute(TransferInformation transferInformation, AcceptedExtensions acceptedExtensions, AcceptedPrefix acceptedPrefix) { var destination = transferInformation.Destination; var sourceDir = transferInformation.Source; var files = _readAndExclude.ReadAndExclude(acceptedExtensions, acceptedPrefix, sourceDir); _copier.Copy(files, destination); var info = String.Format("Files copied from location {0} to location {1}", sourceDir, destination); _consoleImpl.Write(info); }
private void CoreMerge(string destination, IEnumerable <FileInformation> merged) { const int chunkSize = 2 * 1024; // 2KB using (var output = File.Create(destination)) { foreach (var file in merged) { _consoleImpl.Write(String.Format("Merging file {0} to destination file {1}", file.Name, destination)); using (var input = File.OpenRead(file.Path)) { var buffer = new byte[chunkSize]; int bytesRead; while ((bytesRead = input.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, bytesRead); } } } } _consoleImpl.Write(String.Format("Done merging {0}", destination)); }