C# Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

C# Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
RSA Encryption
S/MIME
Socket
Spider
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
POP3
SMTP
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

Create or Update a Zip with Multiple Files

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

This C# sample code shows how to create or update a Zip compression archive with specific files that have been selected for updating.

		// Open (or create) a Zip, add files, and save it.
		private void ZipMultiple_Click(object sender, System.EventArgs e)
		{
			Chilkat.Zip zip = new Chilkat.Zip();

			zip.UnlockComponent("30-day trial");

			if (!zip.OpenZip("MyArchive.zip"))
			{
				zip.NewZip("MyArchive.zip");
			}
			// Add individual files.
			// You will need to modify the AppendFromDir and filenames
			// before running this sample code.
			zip.AppendFromDir = "c:\\sampleData";
			
			// Even though the Windows filesystem is not case sensitive,
			// the Zip entry names (filenames) are case-sensitive.
			Chilkat.ZipEntry entry = zip.GetEntryByName("dudeZip.BMP");
			if (entry != null)
			{
				zip.DeleteEntry(entry);
			}
			zip.AppendFiles("dudeZip.BMP",false);

			entry = zip.GetEntryByName("dudeZip2.BMP");
			if (entry != null)
			{
				zip.DeleteEntry(entry);
			}
			zip.AppendFiles("dudeZip2.BMP",false);

			entry = zip.GetEntryByName("dudeZip3.BMP");
			if (entry != null)
			{
				zip.DeleteEntry(entry);
			}
			zip.AppendFiles("dudeZip3.BMP",false);

			// ... append any number of files...

			// Now save the Zip and close it.
			bool success = zip.WriteZipAndClose();
			if (!success)
			{
				MessageBox.Show(zip.LastErrorText);
			}
			else
			{
				MessageBox.Show("Updated Zip Archive");
			}
		}


 

 

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.

Email Component · XML Parser