private static void Append(string fileToOver, string[] fileToZip, ProgressBar progress) { bool res = false; string currentDir = Path.GetDirectoryName(fileToOver); string copiedFilesPath = currentDir + "\\temp_zip"; res = tmpFiles(fileToOver, fileToZip); UpdateProgressBar(progress, 40.0); //compressione FILES & Join if (res) { WinRAR.COMPRESS(Path.ChangeExtension(fileToOver, ".rar"), copiedFilesPath); UpdateProgressBar(progress, 70.0); joinFiles(fileToOver, progress); } }
public static void EncryptAndAppend(string fileToOver, string[] fileToZip, string password, IAlgorithm encrypter, ProgressBar progress) { bool res = false; string currentDir = Path.GetDirectoryName(fileToOver); string copiedFilesPath = currentDir + "\\temp_zip"; if (String.IsNullOrWhiteSpace(password)) { MessageBox.Show("Encryption Password Missing! Please retry!", "Missing Password!", MessageBoxButton.OK, MessageBoxImage.Exclamation); } UpdateProgressBar(progress, 10.0); res = tmpFiles(fileToOver, fileToZip); UpdateProgressBar(progress, 20.0); int allFile = Directory.GetFiles(copiedFilesPath).Length; int i = 1; if (!String.IsNullOrWhiteSpace(password) && res) { foreach (string s in Directory.GetFiles(copiedFilesPath)) { EncryptFile(s, password, encrypter); UpdateProgressBar(progress, (20 + ((i / (double)allFile) * 40))); i++; } } else { MessageBox.Show("Encryption Password Missing! Please retry!", "Missing Password!", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } //compressione WinRAR.COMPRESS(Path.ChangeExtension(fileToOver, ".rar"), copiedFilesPath); UpdateProgressBar(progress, 80.0); joinFiles(fileToOver, progress); }