예제 #1
0
 public void AddFile(InOutPath job)
 {
     if (replaceAll || new FileInfo(job.input).LastWriteTime > new FileInfo(job.output).LastWriteTime)
     {
         copyJobsBuilder.Add(job);
     }
 }
예제 #2
0
 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))));
     }
 }
예제 #3
0
        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);
        }
예제 #4
0
 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 + "'");
     }
 }
예제 #5
0
 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)]));