UploadSingleFile() public méthode

Allows a file to be put into the root of the bucket. Could be enhanced to specify a sub folder path, but I don't need that for the current use.
public UploadSingleFile ( string pathToFile, IProgress progress ) : string
pathToFile string
progress IProgress
Résultat string
        public static string UploadBook(string bucketName, string bookZipPath, IProgress progress)
        {
            try
            {
                using(var s3Client = new BloomS3Client(bucketName))
                {
                    var url = s3Client.UploadSingleFile(bookZipPath, progress);
                    progress.WriteMessage("Upload Success");
                    return url;
                }

            }
            catch (WebException e)
            {
                progress.WriteError("There was a problem uploading your book: "+e.Message);
                throw;
            }
            catch (AmazonS3Exception e)
            {
                if (e.Message.Contains("The difference between the request time and the current time is too large"))
                {
                    progress.WriteError(LocalizationManager.GetString("PublishTab.Upload.TimeProblem",
                        "There was a problem uploading your book. This is probably because your computer is set to use the wrong timezone or your system time is badly wrong. See http://www.di-mgt.com.au/wclock/help/wclo_setsysclock.html for how to fix this."));
                }
                else
                {
                    progress.WriteError("There was a problem uploading your book: " + e.Message);
                }
                throw;
            }
            catch (AmazonServiceException e)
            {
                progress.WriteError("There was a problem uploading your book: " + e.Message);
                throw;
            }
            catch (Exception e)
            {
                progress.WriteError("There was a problem uploading your book.");
                progress.WriteError(e.Message.Replace("{", "{{").Replace("}", "}}"));
                progress.WriteVerbose(e.StackTrace);
                throw;
            }
        }
 public static string UploadBook(string bucketName, string bookZipPath, IProgress progress)
 {
     try
     {
         using (var s3Client = new BloomS3Client(bucketName))
         {
             var url = s3Client.UploadSingleFile(bookZipPath, progress);
             progress.WriteMessage("Upload Success");
             return(url);
         }
     }
     catch (WebException e)
     {
         progress.WriteError("There was a problem uploading your book: " + e.Message);
         throw;
     }
     catch (AmazonS3Exception e)
     {
         if (e.Message.Contains("The difference between the request time and the current time is too large"))
         {
             progress.WriteError(LocalizationManager.GetString("PublishTab.Upload.TimeProblem",
                                                               "There was a problem uploading your book. This is probably because your computer is set to use the wrong timezone or your system time is badly wrong. See http://www.di-mgt.com.au/wclock/help/wclo_setsysclock.html for how to fix this."));
         }
         else
         {
             progress.WriteError("There was a problem uploading your book: " + e.Message);
         }
         throw;
     }
     catch (AmazonServiceException e)
     {
         progress.WriteError("There was a problem uploading your book: " + e.Message);
         throw;
     }
     catch (Exception e)
     {
         progress.WriteError("There was a problem uploading your book.");
         progress.WriteError(e.Message.Replace("{", "{{").Replace("}", "}}"));
         progress.WriteVerbose(e.StackTrace);
         throw;
     }
 }