/// <summary> /// Encrypt selected files /// </summary> public void EncryptFiles() { if (Progress.Cancelled) { return; } if (ExtentionToEncryptList != null && Directory.Exists(DestinationPath)) { // If we encrypt all files if (extentionToEncryptList.Contains(Extension.ALL)) { // Find all files string[] filesPathToEncrypt = Directory.GetFiles(destinationPath, "*.*", SearchOption.AllDirectories); // For each files foreach (string files in filesPathToEncrypt) { if (Progress.Cancelled) { return; } //Console.WriteLine(files); // Encrypt File Stopwatch watch = new Stopwatch(); watch.Start(); CryptoSoft.CryptoSoftTools.CryptoSoftEncryption(files); watch.Stop(); EditLog.EncryptedFile(this, files, watch.Elapsed.TotalSeconds.ToString()); } } // for each exntensions in the list foreach (Extension extension in extentionToEncryptList) { // Adjusts the format of the extension string extensionReformated = "*." + extension.ToString() + "*"; // Find all files in directory with aimed extensions string[] filesPathToEncrypt = Directory.GetFiles(destinationPath, extensionReformated, SearchOption.AllDirectories); // For each files with aimed extensions foreach (string files in filesPathToEncrypt) { if (Progress.Cancelled) { return; } //Console.WriteLine(files); // Encrypt File Stopwatch watch = new Stopwatch(); watch.Start(); CryptoSoft.CryptoSoftTools.CryptoSoftEncryption(files); watch.Stop(); EditLog.EncryptedFile(this, files, watch.Elapsed.TotalSeconds.ToString()); } } } }