/// <summary> /// Extracts the archive to zip. /// </summary> /// <param name="extractionLocation">The extraction location.</param> /// <param name="fullPathToArchive">The full path to archive.</param> /// <param name="crypto">The crypto.</param> /// <returns> /// An <see cref="OperationResult" /> containing the results /// of the operation. /// </returns> /// <externalUnit/> /// <revision revisor="dev13" date="11/17/2009" version="1.1.3.5"> /// Added documentation header /// </revision> public static OperationResult ExtractArchiveToZip( string extractionLocation, string fullPathToArchive, SequoiaCryptoProvider crypto) { OperationResult result = new OperationResult(); string decryptedArchiveName = Path.ChangeExtension( Path.GetFileName(fullPathToArchive), "zip"); using (var sa = new EncryptedArchive( extractionLocation, decryptedArchiveName, crypto)) { bool decrypted = sa.DecryptToFile( fullPathToArchive, Path.Combine(extractionLocation, decryptedArchiveName), crypto); if (decrypted) { sa.OpenRead(); result = sa.ExtractAllFiles(false); } else { result.Succeeded = false; result.Details = "Failed to decrypt archive."; } } return(result); }
/// <summary> /// Extracts the archive. /// </summary> /// <param name="extractionLocation">The extraction location.</param> /// <param name="fullPathToArchive">The full path to archive.</param> /// <param name="crypto">The crypto.</param> /// <returns> /// An <see cref="OperationResult" /> containing the result of /// the operation. /// </returns> /// <externalUnit/> /// <revision revisor="dev13" date="11/17/2009" version="1.1.3.5"> /// Added documentation header /// </revision> public static OperationResult ExtractArchive( string extractionLocation, string fullPathToArchive, SequoiaCryptoProvider crypto) { OperationResult result = new OperationResult(); using (var sa = new EncryptedArchive( extractionLocation, fullPathToArchive, crypto)) { byte[] decryptedBytes = sa.Decrypt( fullPathToArchive); if (decryptedBytes != null) { sa.OpenRead(decryptedBytes); result = sa.ExtractAllFiles(false); } else { result.Succeeded = false; result.Details = "Failed to decrypt archive."; } } return(result); }