PowerTCP Zip Compression for .NET

from $299.00
Available Platforms

See all PowerTCP Zip Compression for .NET Code Examples

Decompress Zip File Example

The following example demonstrates decompression of a zip file using the Archive component. The archive is AES 256 encrypted. Progress is provided during the operation.


private void buttonUnzip_Click(object sender, EventArgs e)
        //Open a zip file to decompress.

        //Decrypt the zip file using AES 256.
        archive1.DefaultEncryption = Dart.PowerTCP.Zip.Encryption.Aes256Bit;
        archive1.Password = "321!thisIsMyPassword";

        //Decompress the file, preserving paths.
        archive1.PreservePath = true;
    catch (Exception ex)
        //Display message if operation encounters an error.
        textWarnings.AppendText("Error: " + ex.Message + Environment.NewLine);

private void archive1_Progress(object sender, Dart.PowerTCP.Zip.ProgressEventArgs e)
    //Show zip progress for each item in the folder.
    progressItem.Maximum = 100;
    double itemPercent = ((double)e.ProcessedItemBytes / (double)e.Item.Size) * 100;
    progressItem.Value = Convert.ToInt16(itemPercent);

    //Show zip progress for the entire folder.
    progressTotal.Maximum = 100;
    double totalPercent = ((double)e.ProcessedTotalBytes / (double)e.TotalBytes) * 100;
    progressTotal.Value = Convert.ToInt16(totalPercent);

private void archive1_Exception(object sender, Dart.PowerTCP.Zip.ExceptionEventArgs e)
    //Display any warnings that occur during the operation.
    textWarnings.AppendText("Warning: " + archive1[e.Index].Name + " - " +
    e.Exception.Message + Environment.NewLine);


The PowerTCP Zip Compression for .NET Compress a Folder example is included with a trial installation of PowerTCP Zip Compression for .NET. To download a trial please visit the PowerTCP Zip Compression for .NET product page.