Beispiel #1
0
 private void UploadToCloud()
 {
     if (fileQueue.Count == 0)
     {
         return;
     }
     while (fileQueue.Count > 0)
     {
         var currentDirectory = fileQueue.Dequeue();
         if (currentDirectory.SubDirectories != null)
         {
             foreach (var item in currentDirectory.SubDirectories)
             {
                 cloud.UploadDirectory(item);
                 fileQueue.Enqueue(item);
             }
         }
         if (currentDirectory.Files != null)
         {
             foreach (var item in currentDirectory.Files)
             {
                 Task <MemoryStream> task   = Task.Run(() => local.Download(item));
                 MemoryStream        stream = task.Result;
                 cloud.UploadFile(item, stream);
             }
         }
     }
     UploadToCloud();
 }