Exemplo n.º 1
0
 public override async Task DownloadFileAsync(DriveFile driveFile, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token)
 {
     // TODO: use actionIfFileExists
     using (var output = File.OpenWrite(destFolder + Path.DirectorySeparatorChar + driveFile.Name))
     {
         await DownloadFileAsync(driveFile, output, token);
     }
 }
Exemplo n.º 2
0
 public override async Task DownloadFileAsync(StorageFile file, string destFolder,
                                              ActionIfFileExists actionIfFileExists, CancellationToken token, Action <TransferProgress> progressCallback)
 {
     using (var output = File.OpenWrite(Common.AppendToPath(destFolder, file.Name)))
     {
         await DownloadFileAsync(file, output, token, progressCallback);
     }
 }
Exemplo n.º 3
0
 public override async Task DownloadFileAsync(DriveFile driveFile, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token)
 {
     var fileName = Common.AppendToPath(destFolder, driveFile.Name);
     if (System.IO.File.Exists(fileName))
     {
         switch (actionIfFileExists)
         {
             case ActionIfFileExists.Skip:
                 return;
             case ActionIfFileExists.Rewrite:
                 fileName = GetAvailableFileName(fileName);
                 break;
         }
     }
     using (var fileStream = System.IO.File.Create(fileName))
     {
         await DownloadFileAsync(driveFile, fileStream, token);
     }
 }
Exemplo n.º 4
0
 public override Task DownloadFileAsync(StorageFile file, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token, Action<TransferProgress> progressCallback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Download folder or file from storage (not from drive).
 /// </summary>
 /// <param name="destFolder">Path of folder whare to nest a downloaded file or folder.
 /// For example if <paramref name="file"/> is "/photo2010/egypt" and <paramref name="destFolder"/>
 /// is "d:/photos", then in "photos" folder will be created subfolder "egypt" with downloaded files.
 /// </param>
 public async Task DownloadFileFromStorageAsync(AccountFile file, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token, Action <TransferProgress> progressCallback)
 {
     await Storage.DownloadFileAsync(file.StorageFile, destFolder, actionIfFileExists, token, progressCallback);
 }
Exemplo n.º 6
0
        public async Task DownloadFileFromDriveAsync(AccountFile file, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token)
        {
            foreach (var drive in Drives)
            {
                try
                {
                    await drive.DownloadFileAsync(file.GetDriveFile(drive), destFolder, actionIfFileExists, token);

                    return;
                }
                catch (Exception ex)
                {
                    OnError(ex);
                }
            }
            throw new Exception("Can't download this file");
        }
Exemplo n.º 7
0
 public abstract Task DownloadFileAsync(StorageFile file, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token, Action<TransferProgress> progressCallback);
Exemplo n.º 8
0
 public abstract Task DownloadFileAsync(DriveFile driveFile, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token);
Exemplo n.º 9
0
 public abstract Task DownloadFileAsync(StorageFile file, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token, Action <TransferProgress> progressCallback);
Exemplo n.º 10
0
 public async Task DownloadFileFromDriveAsync(AccountFile file, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token)
 {
     foreach (var drive in Drives)
     {
         try
         {
             await drive.DownloadFileAsync(file.GetDriveFile(drive), destFolder, actionIfFileExists, token);
             return;
         }
         catch (Exception ex)
         {
             OnError(ex);
         }
     }
     throw new Exception("Can't download this file");
 }
Exemplo n.º 11
0
 /// <summary>
 /// Download folder or file from storage (not from drive).
 /// </summary>
 /// <param name="destFolder">Path of folder whare to nest a downloaded file or folder.
 /// For example if <paramref name="file"/> is "/photo2010/egypt" and <paramref name="destFolder"/> 
 /// is "d:/photos", then in "photos" folder will be created subfolder "egypt" with downloaded files.
 /// </param>
 public async Task DownloadFileFromStorageAsync(AccountFile file, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token, Action<TransferProgress> progressCallback)
 {
     await Storage.DownloadFileAsync(file.StorageFile, destFolder, actionIfFileExists, token, progressCallback);
 }
Exemplo n.º 12
0
 public override async Task DownloadFileAsync(DriveFile driveFile, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
 public override Task DownloadFileAsync(DriveFile driveFile, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token)
 {
     return(Task.FromResult(0));
 }
Exemplo n.º 14
0
        public override async Task DownloadFileAsync(DriveFile driveFile, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token)
        {
            var fileName = Common.AppendToPath(destFolder, driveFile.Name);

            if (System.IO.File.Exists(fileName))
            {
                switch (actionIfFileExists)
                {
                case ActionIfFileExists.Skip:
                    return;

                case ActionIfFileExists.Rewrite:
                    fileName = GetAvailableFileName(fileName);
                    break;
                }
            }
            using (var fileStream = System.IO.File.Create(fileName))
            {
                await DownloadFileAsync(driveFile, fileStream, token);
            }
        }
Exemplo n.º 15
0
 public override Task DownloadFileAsync(StorageFile file, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token, Action <TransferProgress> progressCallback)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 16
0
 public override async Task DownloadFileAsync(DriveFile driveFile, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token)
 {
     // TODO: use actionIfFileExists
     using (var output = File.OpenWrite(destFolder + Path.DirectorySeparatorChar + driveFile.Name))
     {
         await DownloadFileAsync(driveFile, output, token);
     }
 }
Exemplo n.º 17
0
 public async Task DownloadFileAsync(DriveFileCollection driveFile, string destFolder,
                                     ActionIfFileExists actionIfFileExists, CancellationToken token)
 {
     var file = driveFile.First(x => !x.Drive.IsIgnored);
     await file.Drive.DownloadFileAsync(file, destFolder, actionIfFileExists, token);
 }
Exemplo n.º 18
0
 public abstract Task DownloadFileAsync(DriveFile driveFile, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token);
Exemplo n.º 19
0
 public override async Task DownloadFileAsync(DriveFile driveFile, string destFolder, ActionIfFileExists actionIfFileExists, CancellationToken token)
 {
     throw new NotImplementedException();
 }