public void AddFile(InOutPath job) { if (replaceAll || new FileInfo(job.input).LastWriteTime > new FileInfo(job.output).LastWriteTime) { copyJobsBuilder.Add(job); } }
public void AddDirectory(InOutPath job) { directoryJobs.Add(job); foreach (FileInfo file in new DirectoryInfo(job.input).EnumerateFiles("*", new EnumerationOptions { IgnoreInaccessible = true, RecurseSubdirectories = true })) { AddFile(new InOutPath(file.FullName, Path.Combine(job.output, Path.GetRelativePath(job.input, file.FullName)))); } }
private bool GetJob(out InOutPath job) { int index = Interlocked.Increment(ref copyJobIndex); if (index >= copyJobs.Length) { job = new InOutPath(); return(false); } ; job = copyJobs[index]; return(true); }
public void Add(InOutPath job) { if (File.Exists(job.output)) { AddFile(job); } else if (Directory.Exists(job.input)) { AddDirectory(job); } else { throw new DirectoryNotFoundException("Could not find Directory/File '" + job.input + "'"); } }
public async Task MergeAsync(CancellationToken cancel) { { foreach (InOutPath job in directoryJobs) { DirectoryInfo sourceDir = new DirectoryInfo(job.input); foreach (DirectoryInfo dir in sourceDir.EnumerateDirectories("*", new EnumerationOptions { IgnoreInaccessible = true, RecurseSubdirectories = true })) { Directory.CreateDirectory(Path.Combine(job.output, Path.GetRelativePath(job.input, dir.FullName))); } } ; directoryJobs.Clear(); InOutPath[] mergeRequest = mergeRequests.ToArray(); mergeRequests.Clear(); InOutPath last = new InOutPath(); int indexStart = 0; for (int i = 0; i < mergeRequest.Length; i++) { if (!mergeRequest[i].Equals(last)) { mergeJobsBuilder.Add(new MergeInOutPath(mergeRequest[indexStart..(i + 1)]));