Chilkat ActiveX Components

  Chilkat .NET Components

  Chilkat C++ Libraries

 

.NET Zip Compression Component C# Zip Compression Example Programs

Version 10.1.0

Powerful .NET Zip Compression Component
for Visual Basic .NET / C++ .NET / C# .NET / J# .NET (Java)

30-Day Unlock CodeDocumentation Direct DownloadLicense

C# Zip Compression Source Code Examples

Download the Projects and Source Code

  1. Create a Zip File and Demonstrate All Progress Monitoring Events (C# Source Code)
  2. Create a Password-Protected Zip File (C# Source Code)
  3. Create an AES Encrypted Zip File (C# Source Code)
  4. Open a Zip File and List the Contents (C# Source Code)
  5. Open and Unzip a Zip File (C# Source Code)

Create an AES Encrypted Zip File

private void Zip_Click(object sender, System.EventArgs e)
{
	Zip zip = new Zip();
	zip.UnlockComponent(unlockCode);


	// Rijndael (AES) = 3, Blowfish = 1, Twofish = 2
	zip.Encryption = 3;
	zip.EncryptKeyLength = 128;		// Use 128-bit encryption
	zip.SetPassword(Password.Text);


	zip.NewZip(ZipFilename.Text);



	// Progress monitoring events are demonstrated in CreateZip.cs
	// For simplicity, we are not showing progress in this event.
	createStatus.Text = "Creating Zip, please wait...";
	createStatus.Refresh();

	if (!zip.AppendFiles(FilePattern.Text,true))
	{
		createStatus.Text = "Failed to append files, check errors.xml";
		zip.SaveLastError("errors.xml");
		return;
	}
	if (!zip.WriteZipAndClose())
	{
		createStatus.Text = "Failed to write Zip, check errors.xml";
		zip.SaveLastError("errors.xml");
		return;
	}

	createStatus.Text = "Zip file created";
}

 

Privacy Statement. Copyright 2000-2005 Chilkat Software, Inc. All rights reserved.
Send feedback to admin@chilkatsoft.com

Components for Microsoft Windows XP, 2000, NT, 95/98/ME
Chilkat Self-Extracting EXE
XML Parser