示例#1
0
 private void EnumerateFilesRecursiveAsync(DirectoryInfo folder, AccountFile destDirectory, AsyncTask task, CancellationToken token)
 {
     foreach (var file in folder.EnumerateFiles())
     {
         if (token.IsCancellationRequested)
         {
             return;
         }
         //var newTask = task == null
         //    ? new UploadFileTask(Account, AccountName, 0, null, file.FullName, destDirectory)
         //    : new UploadFileTask(Account, AccountName, 0, new[] { task }, file.FullName, null);
         var newTask = new UploadFileTask(Account, AccountName, 0, new[] { task }, file.FullName, null);
         AddTask(newTask);
         lastTask.AddParent(newTask);
     }
     foreach (var dir in folder.EnumerateDirectories())
     {
         if (token.IsCancellationRequested)
         {
             return;
         }
         //var newTask = task == null
         //    ? new CreateFolderTask(Account, AccountName, 0, null, dir.Name, destDirectory)
         //    : new CreateFolderTask(Account, AccountName, 0, new[] { task }, dir.Name, null);
         var newTask = new CreateFolderTask(Account, AccountName, 0, new[] { task }, dir.Name, null);
         AddTask(newTask);
         lastTask.AddParent(newTask);
         EnumerateFilesRecursiveAsync(dir, destDirectory, newTask, token);
     }
     OnProgress(new AsyncTaskProgressEventArgs(0, null));
 }
示例#2
0
 private void EnumerateFilesRecursiveAsync(DirectoryInfo folder, AccountFile destDirectory, AsyncTask task, CancellationToken token)
 {
     foreach (var file in folder.EnumerateFiles())
     {
         if (token.IsCancellationRequested)
             return;
         //var newTask = task == null
         //    ? new UploadFileTask(Account, AccountName, 0, null, file.FullName, destDirectory)
         //    : new UploadFileTask(Account, AccountName, 0, new[] { task }, file.FullName, null);
         var newTask = new UploadFileTask(Account, AccountName, 0, new[] { task }, file.FullName, null);
         AddTask(newTask);
         lastTask.AddParent(newTask);
     }
     foreach (var dir in folder.EnumerateDirectories())
     {
         if (token.IsCancellationRequested)
             return;
         //var newTask = task == null
         //    ? new CreateFolderTask(Account, AccountName, 0, null, dir.Name, destDirectory)
         //    : new CreateFolderTask(Account, AccountName, 0, new[] { task }, dir.Name, null);
         var newTask = new CreateFolderTask(Account, AccountName, 0, new[] { task }, dir.Name, null);
         AddTask(newTask);
         lastTask.AddParent(newTask);
         EnumerateFilesRecursiveAsync(dir, destDirectory, newTask, token);
     }
     OnProgress(new AsyncTaskProgressEventArgs(0, null));
 }