Esempio n. 1
0
 public async Task DownloadFileAsync(string path, string file, string rootPath = null)
 {
     try
     {
         if (string.IsNullOrEmpty(rootPath))
         {
             rootPath = _path;
         }
         var fileBytes = (await _client.GetFileTask(rootPath + file)).RawBytes;
         using (var fileStream = File.Open(path, FileMode.OpenOrCreate))
         {
             await fileStream.WriteAsync(fileBytes, 0, fileBytes.Length);
         }
     }
     catch (DropboxException)
     {
         throw new CloudException("Couldn't dowload file from cloud.");
     }
 }