Example #1
0
 //Encrypts a file and returns the new file path.
 protected async Task <string> EncryptFileAsync(string path)
 {
     try
     {
         return(await Task.Run(() =>
         {
             MessageEncryption.FileEncrypt(Path.GetFullPath(path));
             path += MessageEncryption.Extension;
             return path;
         }, Token));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
 //Encrypts a file and returns the new file path.
 protected async Task <string> EncryptFileAsync(string path)
 {
     try
     {
         return(await Task.Run(() =>
         {
             var outPath = path + MessageEncryption.Extension;
             var info = MessageEncryption.FileEncrypt(Path.GetFullPath(path), outPath);
             return info.FullName;
         }, Token));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }