/// <summary> /// Decrypts the archive to folder. /// </summary> /// <param name="selectedArchive">The selected archive.</param> /// <param name="privateKey">The private key.</param> /// <externalUnit/> /// <revision revisor="dev13" date="11/18/2009" version="1.1.3.6"> /// Added documentation header /// </revision> private void DecryptArchiveToFolder( string selectedArchive, string privateKey) { try { string folderPath = Path.GetDirectoryName(selectedArchive); string filename = Path.GetFileName(selectedArchive); string publicKey = string.Empty; FileManifestItem item = new FileManifestItem( folderPath, filename); var validationResult = item.IsValid(folderPath); if (validationResult.Succeeded == false) { MessageBox.Show("Validation of encrypted package failed."); } else { MessageBox.Show( "Validation of encrypted package succeeded."); } var result = EncryptedArchive.ExtractArchive( folderPath, selectedArchive, new SequoiaCryptoProvider()); if (result.Succeeded) { MessageBox.Show( "The selected archive has been extracted.", "Archive extraction succeeded", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show( result.Details, "Archive extraction failed", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception exception) { MessageBox.Show( string.Format( "Error creating dencrypted archive folder: {0}", exception.Message), "Archive Decryption Failure", MessageBoxButton.OK, MessageBoxImage.Error); } }
private static List<FileManifestItem> CreateManifestItemsFromFiles(List<string> files, string rootDirPath) { List<FileManifestItem> items = new List<FileManifestItem>(); foreach (string file in files) { string finalFilePath = file; if (file.StartsWith(rootDirPath)) { finalFilePath = finalFilePath.Substring(rootDirPath.Length + 1); } FileManifestItem item = new FileManifestItem { File = finalFilePath }; items.Add(item); } return items; }