Welcome to the PowerTCP Zip Compression for .NET Documentation

PowerTCP Zip Compression for .NET

PowerTCP Zip Compression for .NET Documentation

PowerTCP Zip Compression for .NET enables not only standard zip file/stream compression and decompression, but also allows for fine-tuned data configuration. The powerful Archive component represents all data as individual items in a collection, regardless of whether their source is compressed or uncompressed, exposing their properties for customization. This technology allows for mixing uncompressed data with previously compressed files and recompressing them into new archives.

Developers using Microsoft ASP.NET will benefit from the extensive stream support in PowerTCP Zip Compression for .NET. All compression and decompression operations include support for stream sources and destinations. This capability allows web developers to seamlessly compress data and return it to a requesting client without writing temporary files and enabling write-access on the server.

Other great features include QuickZip and QuickUnzip shortcut features that allow for zip operations with only one line of code, wildcard support for batch operations, multi-threaded asynchronous capability for "behind-the-scenes" operation, the ability to span across multiple disk or create split files, fully configurable self-extraction executables, and support for reading the gZip file format.

In PowerTCP Zip Compression for .NET Documentation.

Getting Started
Provides an overview of PowerTCP Zip Compression for .NET and discusses such topics as distribution, licensing, and support.
Using PowerTCP in VS.NET
Provides step-by-step instructions for creating a project using VS.NET, integrating PowerTCP Zip Compression for .NET, and creating a simple application.
Using the Archive Component
Discusses how to use the Archive component to compress/decompress files.
Using Events in PowerTCP
Discusses how to use the events provided by PowerTCP Zip Compression for .NET.
Reference
Provides a language/syntax reference for PowerTCP Zip Compression for .NET.
Samples
Describes the samples that are installed with PowerTCP Zip Compression for .NET.

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Getting Started

PowerTCP Zip Compression for .NET is a complete suite of controls, components, and classes that enable the integration of file compression/decompression into any .NET application. This topic, and related subtopics, address issues such as licensing, distribution, and support for PowerTCP Zip Compression for .NET. To find a tutorial or walkthrough pertaining to usage of PowerTCP Zip Compression for .NET, see the Documentation Map. For a programmer's reference of the classes used by the PowerTCP Zip Compression for .NET, see the Reference topic.

In This Section

Documentation Map
Provides a good navigational aid to quickly find the topic you want.
Requirements
Discusses the requirements needed to use PowerTCP Zip Compression for .NET.
License Installation
Provides step-by-step instructions on installing a license.
Trial Operation
Provides an overview on using PowerTCP Zip Compression for .NET in trial mode.
Deployment in ASP.NET
Discusses the extra steps that are required to distribute an application in ASP.NET.
Support
Provides an overview of the support options that are available for this product.

Related Sections

Using PowerTCP in VS.NET
Provides step-by-step instructions for creating a project using VS.NET, integrating PowerTCP Zip Compression for .NET, and creating a simple application.
Using the Archive Component
Discusses how to use the Archive component to compress/decompress files.
Using Events in PowerTCP
Discusses how to use the events provided by PowerTCP Zip Compression for .NET.
Reference
Provides a language/syntax reference for PowerTCP Zip Compression for .NET.
Samples
Describes the samples that are installed with PowerTCP Zip Compression for .NET.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Documentation Map

The following topics were designed to get you quickly developing using PowerTCP Zip Compression for .NET

To | See
Learn how to create a project in Visual Studio .NET. | Creating a Project
Learn how to add a component to a form. | Creating an Instance of a Component Using Visual Studio .NET
Learn how to add a component to a project as a reference. | Adding a Component as a Reference within Visual Studio .NET
Learn how to quickly create a compressed file. | Using QuickZip to Quickly Compress Data - File
Learn how to quickly create a compressed stream. | Using QuickZip to Quickly Compress Data - Stream
Learn how to quickly create a compressed file or stream using asynchronous techniques. | Using QuickZip to Quickly Compress Data - Asynchronous
Learn how to quickly unzip a compressed file. | Using QuickUnzip to Quickly Decompress Data - File
Learn how to quickly unzip a compressed stream. | Using QuickUnzip to Quickly Decompress Data - Stream
Learn how to quickly decompress a compressed file or stream using asynchronous techniques. | Using QuickZip to Quickly Decompress Data - Asynchronous
Learn about advanced techniques when compressing files. | Advanced Data Compression - File
Learn about advanced techniques when compressing streams. | Advanced Data Compression - Stream
Learn about advanced techniques when compressing using asynchronous techniques. | Advanced Data Compression - Asynchronous
Learn about advanced techniques when decompressing files. | Advanced Data Decompression - File
Learn about advanced techniques when decompressing to a stream. | Advanced Data Decompression - Stream
Learn how to asynchronously unzip an archive. | Advanced Data Compression - Asynchronous - Archive
Learn how to asynchronously unzip an archive item. | Advanced Data Compression - Asynchronous - Archive Item
Learn how to encrypt files. | Using Encryption - Encryption
Learn how to decrypt files. | Using Encryption - Decryption
Learn how create a self-extracting archive. | Using Self Extraction

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Requirements

In order to use PowerTCP Zip Compression for .NET you must have the following:

  • Microsoft Visual Studio .NET (Recommended)
  • .NET Framework

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


License Installation

Your PowerTCP License Agreement provides you with a single-seat development license and the right to distribute PowerTCP classes with NO ROYALTIES of any kind. Some PowerTCP classes are marked as licensed. This topic covers:
  • Trial Installation
  • Installing a Fully Licensed PowerTCP Product
  • Re-installing a PowerTCP Product
  • License Details

Trial Installation

Installing a PowerTCP product as a fully–functional trial involves running the setup program (available from www.dart.com) without completing the Registration process. The trial will operate for 30 days after installation. Proceed to step 2 of Installing a Fully Licensed PowerTCP Product when you are ready to license the product.

See Trial Operation for more information.

Installing a Fully Licensed PowerTCP Product

Once you have downloaded the latest version, complete the following steps to register your PowerTCP product:

  1. From the Start menu, select Programs, select PowerTCP, select the PowerTCP product you downloaded, and then click Registration.
  2. In the PowerTCP Registration dialog box, click Register.
  3. Enter your Serial Number, First Name, Last Name, and Organization information.
  4. Click Next.
  5. Enter your Email Address, Purchased From, and Purchase Date information.
  6. Click Next.
  7. Verify that the information is correct, and then click Next.
  8. When the registration process is complete, click Exit. (Note: Clicking Done at this step displays your currently registered PowerTCP product. Click Exit to complete the registration process and close the dialog box.)
If you do not have Internet Access on your development machine, please follow these instructions:
  1. From the Start menu, select Programs, select PowerTCP, select the PowerTCP product you downloaded, and then click Registration.
  2. In the PowerTCP Registration dialog box, click Edit.
  3. Enter your serial number in the Serial # field.
  4. Write down the number in the Key field.
  5. On a machine that has Internet access, log on to the Dart registration page (http://www.dart.com/register/).
  6. Enter all required information. Required information is bolded. The Key is the number you wrote down in Step 4.
  7. Click Submit. A seven-digit registration code should appear.
  8. On your machine (the machine on which you completed Steps 1-4), if necessary, access the PowerTCP Registration dialog box to display the Currently Registered Products area containing the Key number.
  9. Enter your serial number and the seven-digit registration number you obtained in Step 6.
  10. Click Add.
  11. Click Exit.

After either of the two registration procedures are complete, your PowerTCP product appears in the Registered Tools field at the top of the registration form. Make sure you recompile your application after you register the PowerTCP product.

If you do not register your PowerTCP product at this point, it will operate as a trial.

Re-installing a PowerTCP Product

The Key provided by the Registration Program is derived from a system number that is changed when the C: drive is reformatted. If you reformat your hard disk and need to re-install your PowerTCP product, follow the steps in Installing a Fully Licensed PowerTCP Product. A new Registration Number will be generated.

License Details

When you insert a PowerTCP component into a project, most development environments verify that the class is licensed for development. The component will work if you correctly entered the PowerTCP product Serial Number. See Installing a Fully Licensed PowerTCP Product for more information. When you compile your application, the development environment requests this Serial Number and embeds it in the application. When users run your application, the application submits this Serial Number to the class and the Serial Number is checked for validity. If the Serial Number is correct, then the application runs. This verification process occurs automatically.

If you have any problems registering your license, please contact Dart at 315-339-8040.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Trial Operation

If you install a PowerTCP product without registering a Serial Number, it operates as a fully–functional trial for up to 30 days. If you need more time to evaluate the product, contact the Sales Department at sales@dart.com.

Trial Notification in Development Mode

Trial notification does not occur during design-time.

Trial Notification During Run-Time

PowerTCP products request a Serial Number when you compile your application. A dialog box appears warning you that the component is not licensed for deployment. Do not distribute your application using a trial product—the component will not work after the trial period! However, you may test your application for the duration of your trial period, during which time trial notification will occur with Windows applications. No trial notification will occur with Web applications so the application can run unhindered. Please be aware that the component will cease to function after the trial period has expired.

See License Installation for more information on product registration.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Deployment In ASP.NET

To deploy a licensed ASP.NET Web Application or Web Service, follow these steps.

  1. Compile the ASP.NET application on a licensed development machine.
  2. If you are instantiating the component dynamically, be sure to include a licenses.licx file (see the Creating The Licenses.licx File topic for more information.
  3. Copy the contents of the bin folder and the ASP.NET source files (such as .aspx files) to the server that will be hosting the application.
  4. Create a virtual directory pointing to the folder containing the Web Application or Web Service.

Note: It is not necessary for the deployment server to be licensed or to contain a copy of a license in its registry.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Support Options

Our mission at Dart is to deliver high quality Internet connectivity solutions to Internet application developers. Our goal is to supplement these solutions with timely support resources that can help at many different levels.

Related Links (you have an active connection to the Internet to view these links).

Paid Support Options
Discusses the paid support options available from single incident support to comprehensive support subscriptions.
Free Support Options
Provides access to free materials to help your development, including FAQS, online help files, tutorials, code snippets, online asp samples, and a free support forum.
Support Forum
Provides access to our support forum, monitored by our own development staff as time permits.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using PowerTCP within Visual Studio .NET

PowerTCP Zip Compression for .NET is a complete suite of classes which enable the integration of file compression/decompression into any .NET application. This topic and associated subtopics are mostly prerequisite to the usage of PowerTCP Zip Compression for .NET. For example, this topic illustrates such things as basic usage within Visual Studio.NET and how to add components as a reference. If you are already familiar with these tasks, you may benefit more by examining other topics.

In This Section

Creating a Project
This topic demonstrates how to create a new Windows project in Visual Studio .NET.
Creating an Instance of a Component within Visual Studio .NET
This topic demonstrates how to create and use a component using Visual Studio .NET.
Adding a Component as a Reference
This topic demonstrates how to add a component as a reference using Visual Studio .NET.
Creating the Licenses.licx File
This topic demonstrates how to create the licenses.licx file. This is only necessary when adding the component as a reference.
Using a PowerTCP Component in Your Own Custom DLL
Discusses the steps required when creating a dll that uses a PowerTCP component.
Synchronous Vs Asynchronous Use
This topic discusses the benefits and uses for synchronous and asynchronous methods.

Related Sections

Getting Started
Provides an overview of PowerTCP Zip Compression for .NET and discusses such topics as distribution, licensing, and support.
Using the Archive Component
Discusses how to use the Archive component to compress/decompress files.
Using Events in PowerTCP
Discusses how to use the events provided by PowerTCP Zip Compression for .NET.
Reference
Provides a language/syntax reference for PowerTCP Zip Compression for .NET.
Samples
Describes the samples that are installed with PowerTCP Zip Compression for .NET.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Creating a Project

The following steps provide a walkthrough to create a project in Visual Studio.NET.

To create a project in Visual Studio .NET, use the following steps:

  1. Start Visual Studio .NET.
  2. From the File menu, choose New, and then choose Project.
  3. From the resulting dialog box, choose either Visual C# Projects or Visual Basic Projects and then choose Windows Application. Alternatively, if you wish to create an ASP.NET web application, you can choose ASP.NET Web Application. Specify a name and a location for the project, and then click OK.

  4. After these steps have been completed, the project is created.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Creating an Instance of a Component using VS.NET

PowerTCP Zip Compression for .NET

Creating an Instance of a Component Using Visual Studio .NET

To create a component within Visual Studio .NET, use the following steps (the following steps demonstrate using the Archive component):

  1. Create a project as described in Creating a Project .
  2. Add the Archive control to the form. To do this, right-click on the ToolBox and choose Customize ToolBox. If the ToolBox is not visible, navigate to the View menu and choose ToolBox.

  3. From the resulting dialog box, choose the .NET Framework Components tab, then scroll until you find the Archive component (see the screen shot below). Check the checkbox next to it and select OK.

  4. Click the Archive component icon on the ToolBox, and "drag" an instance of it onto the form. The Visual Studio .NET environment will automatically create and instantiate an instance of the Archive component within your code and on the form.
  5. Make a quick application to test. Drag a button onto the form.
  6. Add the following code to the button "on-click" event handler.
    [C#]
// Add an uncompressed file to the archive
archive1.Add("C:\\temp\\image.bmp");

// Compress the file
archive1.Zip("C:\\temp\\image.zip");
[Visual Basic]
' Add an uncompressed file to the archive
Archive1.Add("C:\temp\image.bmp");

' Compress the file
Archive1.Zip("C:\temp\image.zip");
  7. Navigate to the Debug menu and choose Start. The app will compile and execute. Click the button to compress your file.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Adding a Component as a Reference within VS.NET

PowerTCP Zip Compression for .NET

Adding a Component as a Reference within Visual Studio .NET

When using Visual Studio .NET, the components included in PowerTCP Zip Compression for .NET can either be used as a component (see Using PowerTCP within Visual Studio .NET for more information) or added as a reference. If you are using one of the components as a reference, there are a few extra steps you must take, namely:

  • You must instantiate your own event handlers.
  • You must add a licenses.licx file to the project. (See Creating the Licenses.licx File for more information).

The following steps illustrate how to add a component as a reference within Visual Studio .NET

To add a component as a reference within Visual Studio .NET , use the following steps (the following steps demonstrate adding the Archive component):

  1. Create a project as described in Creating a Project.
  2. Add the Archive component as a reference. To do this right-click the References folder in the Solution Explorer and choose Add Reference (see the screen shot below). If the Solution Explorer is not visible, navigate to the View menu and choose Solution Explorer.

  3. You must add a licenses.licx file to the project. (See Creating the Licenses.licx File for more information).
  4. Make a quick application to test. Drag a button onto the form.
  5. Create an instance of the Archive component within the button "on-click" event handler. (Don’t forget to add the namespaces for Dart.PowerTCP.Zip).
    6. [C#]
Archive archive1 = new Archive();
[Visual Basic]
Dim Archive1 As New Archive()
  6. Add the following code to the button "on-click" event handler immediately after the code to create the Archive component.\
    7. [C#]
// Add an uncompressed file to the archive
archive1.Add("C:\\temp\\image.bmp");

// Compress the file
archive1.Zip("C:\\temp\\image.zip");
[Visual Basic]
' Add an uncompressed file to the archive
Archive1.Add("C:\temp\image.bmp");

' Compress the file
Archive1.Zip("C:\temp\image.zip");
  7. Add a licenses.licx file to the project as described in Creating the Licenses.licx File.
  8. Navigate to the Debug menu and choose Start. The application will compile and execute. Click the button to compress your file.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Creating the Licenses.licx File

Note: If you are creating a component by dragging it from the toolbox, you do not need to create a licenses.licx file, as one will be created by the environment. These steps apply only if you are using a component as a reference, or from a non-Visual Studio .NET environment.

To create a licenses.licx file, use the following steps (This example demonstrates using the Archive component).

  1. Start a new application in Visual Studio .NET and add the Archive component as a reference.
  2. In the Solution Explorer, right-click the project name, choose Add, then Add New Item.
  3. From the resulting dialog box, choose Text File and name the file "licenses.licx". Click Open.
  4. Type the following in the licenses.licx file

    Dart.PowerTCP.Zip.Archive, Dart.PowerTCP.Zip

    and save the file. You should now be able to compile and run a project that uses the Archive component as a reference.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using a PowerTCP Component in Your Own Custom DLL

PowerTCP components can be used within a standard desktop application (EXE), a Web Service, a Windows Service, an ASP.NET application, and your own custom dynamic-link library (DLL). It is not necessary to provide licensing information for the custom dll, however it is necessary for any application which uses the custom dll. For example, if you have a dll ("Helper.dll") that uses a PowerTCP component it is not necessary to provide licensing info for the dll. However, if you have an an application ("App1.exe") that references "Helper.dll", the application will have to have a "licenses.licx" file containing the component information for the PowerTCP component (see Creating The Licenses.licx File for more information about creating "licenses.licx" files). In addition, "App1.exe" must be compiled on a machine that has a properly registered PowerTCP component.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Synchronous Versus Asynchronous Methods

The decision of whether to use synchronous or asynchronous methods can be crucial and have an impact on the complexity of your code and the user experience.

The following lists discuss some of the characteristics of synchronous and asynchronous methods in PowerTCP.

Synchronous Methods

  • Are easier to implement and use than asynchronous.
  • Do not require an event to implement.
  • Results are returned directly from the method call.
  • Error handling occurs during the method call.

Asynchronous Methods

  • Occur on a new thread.
  • Are slightly more difficult to implement and use than synchronous.
  • Must have an event handler to handle the response.
  • Results are returned to the event handler.
  • Error handling occurs within the associated event handler.

Most applications written with PowerTCP will be synchronous. The reasons for this are not purely due to the ease-of-use of synchronous methods. Synchronous methods are ideal for automated processes that can execute a blocking method for a period of time. In addition, synchronous methods can work well for interactive applications. The Object.DoEvents property controls the processing of user interface messages while a synchronous method is executing. This means that while a synchronous method is executing, other portions of the application will be able to respond to events (for example, button or menu clicks).

Asynchronous methods, on the other hand, provide a great deal of power. When an asynchronous method is called, the method will execute on a thread separate from the calling thread. Such operation is useful when an action is time consuming and other code needs to execute without waiting for the initial operation to complete. In addition, the user interface will be most responsive when asynchronous methods are used. Asynchronous methods are generally required for interactive on-line applications such as emulators, where received data must be displayed whenever it arrives.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using The Archive Component

PowerTCP Zip Compression for .NET is designed for both users who require little configuration and just want compression/decompression capability and users who require more advanced requirements. This section is focused on providing examples of very simple usage to get you up and running in the shortest possible time.

In This Section

Using QuickZip to Quickly Compress Data
Provides a walkthough of the quickest and easiest way to compress data.
Using QuickZip to Quickly Decompress Data
Provides a walkthough of the quickest and easiest way to decompress data.
Advanced Data Compression
Discusses advanced techniques for compressing data.
Advanced Data Decompression
Discusses advanced techniques for decompressing data.
Using Encryption
Provides a walkthrough of how to encrypt and decrypt data using the Archive component.
Using Self-Extraction
Demonstrates how to create a self-extracting zip file.

Related Sections

Getting Started
Provides an overview of PowerTCP Zip Compression for .NET and discusses such topics as distribution, licensing, and support.
Using PowerTCP in VS.NET
Provides step-by-step instructions for creating a project using VS.NET, integrating PowerTCP Zip Compression for .NET, and creating a simple application.
Using Events in PowerTCP
Discusses how to use the events provided by PowerTCP Zip Compression for .NET.
Reference
Provides a language/syntax reference for PowerTCP Zip Compression for .NET.
Samples
Describes the samples that are installed with PowerTCP Zip Compression for .NET.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using QuickZip to Quickly Compress Data

The QuickZip method presents a quick and easy way to compress a given source to a specified zip archive. It combines the two operations of Add and Zip into a single operation. The source is a filename, and can include wildcards. The destination can be a file or stream, according to the application needs.

The following subtopics are addressed:

  • Quickly zipping to a compressed file
  • Quickly zipping to a compressed stream
  • Asynchronous quick zipping

Quickly zipping to a compressed file

To quickly and easily zip a file or wildcard collection of files to a compressed file:

  1. Add the Archive component to a new form. For instructions on how to do this see, "Creating An Instance Of A Component Using Visual Studio .NET."
  2. Add a button to the form.
  3. Specify the archive properties. For example, set the Password and Encryption properties to encrypt the entire collection. In the example to follow, all files in the directory "c:\Test" and its subdirectories, with the exception of "txt" files, are archived to the file "c:\test.zip". The archived files’ paths are preserved during compression. Begin by placing the code below in the click event of the button added to the form in step 2.
    [Visual Basic]
Archive1.PreservePath = True
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "*.txt"
[C#]
archive1.PreservePath = true;
archive1.IncludeSubs = true;
archive1.ExcludePattern = "*.txt";
  4. Use the QuickZip method to create the zip file. Place the following code directly after the code from step 3.
    [Visual Basic]
Archive1.QuickZip("c:\Test\*.*", "c:\test.zip")
[C#]
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");
  5. Compile and run the application. After pressing the button, a new archive "c:\test.zip" with the files from "c:\Test" should be found on disk.

Quickly zipping to a compressed stream

To zip a file or wildcard collection of files to a compressed stream:

  1. Follow steps 1, 2 and 3 above, for zipping to a compressed file.
  2. Create a stream to hold the compressed archive.
    3. [Visual Basic]
Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream()
[C#]
System.IO.MemoryStream stream = new System.IO.MemoryStream();
  3. Use the QuickZip method to save the compressed archive to memory.
    4. [Visual Basic]
Archive1.QuickZip("c:\Test\*.*", stream)
[C#]
archive1.QuickZip("c:\\Test\\*.*", stream);
  4. Show the length of the new compressed archive.
    5. [Visual Basic]
MessageBox.Show("The size of the compressed stream is " + stream.Length.ToString() + "bytes.")
[C#]
MessageBox.Show("The size of the compressed stream is " + stream.Length.ToString() + " bytes.");
  5. Compile and run the application. After pressing the button, a MessageBox with the size of the stream should be visible.

Asynchronous quick zipping

To zip a file or wildcard collection of files asynchronously:

  1. Follow steps 1, 2 and 3 above, for zipping to a compressed file.
  2. Use the asynchronous BeginQuickZip method to create the zip file.
    3. [Visual Basic]
Archive1.BeginQuickZip("c:\Test\*.*", "c:\test.zip", Nothing)
[C#]
archive1.BeginQuickZip("c:\\Test\\*.txt", "c:\\test.zip", null);
  3. Add code for the EndZip Event. When using the BeginXXX methods, you must have corresponding EndXXX events (see the Using Events In PowerTCP section for more details).
    4. [Visual Basic]
Private Sub Archive1_EndZip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndZip
   Try
      If (e.Exception Is Nothing) Then
         MessageBox.Show("Zip Complete!")
      Else
         MessageBox.Show(e.Exception.Message)
      End If
   Catch
   End Try
 End Sub

[C#]
private void archive1_EndZip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
   try
   {
      if (e.Exception == null)
         MessageBox.Show("Zip Complete!");
      else
         MessageBox.Show(e.Exception.Message);
   }
   catch {}
}
  4. Compile and run the application. After pressing the button, a new archive "c:\test.zip" with the files from "c:\Test" should be found on disk.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using QuickUnzip to Quickly Decompress Data

The QuickUnzip method presents a quick and easy way to decompress a given zip archive to a source directory on disk. It combines the two operations of Open and Unzip. The source can be a filename or compressed stream. The destination is a path on disk.

The following subtopics are addressed:

  • Quickly unzipping from a compressed file
  • Quickly unzipping from a compressed stream
  • Asynchronous quick unzipping

Quickly unzipping from a compressed file

To quickly and easily unzip a file archive to a path on disk:

  1. Add the Archive component to a new form. For instructions on how to do this see, "Creating An Instance Of A Component Using Visual Studio .NET."
  2. Add a button to the form.
  3. Specify the archive properties. For example, set the Password and Encryption properties to decrypt the entire collection. In the example to follow, all files in the zip archive "c:\test.zip" are extracted to the directory "c:\Test". The archived files’ paths are preserved during decompression, and all existing files will be overwritten. Begin by placing the code below in the click event of the button added to the form in step 2.
    [Visual Basic]
Archive1.PreservePath = True
Archive1.Overwrite = Always
[C#]
archive1.PreservePath = true;
archive1.Overwrite = Overwrite.Always;
  4. Use the QuickUnzip method to extract files from the zip archive. Place the following code directly after the code from step 3.
    [Visual Basic]
Archive1.QuickUnzip("c:\test.zip", "c:\Test")
[C#]
archive1.QuickUnzip("c:\\test.zip", "c:\\Test");
  5. Compile and run the application. After pressing the button, the archived files contained in "c:\test.zip" will be extracted to the path "c:\Test".

Quickly unzipping from a compressed stream

To unzip a compressed stream to a path on disk:

  1. Follow steps 1, 2 and 3 above, for unzipping from a compressed file.
  2. Use the QuickUnzip method to extract the items in a compressed stream to a path on disk. The stream could be a FileStream (see the example below), or a MemoryStream (see the compressing to a stream section of the Using QuickZip page).
    3. [Visual Basic]
Dim stream As New System.IO.FileStream("c:\test.zip", System.IO.FileMode.Open)
Archive1.QuickUnzip(stream, "c:\Test")
[C#]
System.IO.FileStream stream = new System.IO.FileStream("c:\\test.zip", System.IO.FileMode.Open);
archive1.QuickUnzip(stream, "c:\\Test");
  3. Compile and run the application. After pressing the button, the files from the compressed archive should be found in "c:\Test".

    4. Asynchronous quick unzipping

    To unzip a file archive asynchronously:

    1. Follow steps 1, 2 and 3 above, for unzipping from a compressed file.
    2. Use the asynchronous BeginQuickUnzip method to extract the archived files.
      3. [Visual Basic]
Archive1.BeginQuickUnzip("c:\test.zip", "c:\Test", Nothing)
[C#]
archive1.BeginQuickUnzip("c:\\test.zip", "c:\\Test", null);
    3. Add code for the EndUnzip Event. When using the BeginXXX methods, you must have corresponding EndXXX events (see the Using Events In PowerTCP section for more details).
      4. [Visual Basic]
Private Sub Archive1_EndUnzip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndUnzip
   Try
      If (e.Exception Is Nothing) Then
         MessageBox.Show("Extraction Complete!")
      Else
         MessageBox.Show(e.Exception.Message)
      End If
   Catch
   End Try
End Sub

[C#]
private void archive1_EndUnzip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
   try
   {
      if (e.Exception == null)
         MessageBox.Show("Extraction Complete!");
      else
         MessageBox.Show(e.Exception.Message);
   }
   catch {}
}
    4. Compile and run the application. After pressing the button, the archived files contained in "c:\test.zip" will be extracted to the path "c:\Test".

    See Also

    Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

    Send comments on this topic.

    © 2004 Dart Communications. All rights reserved.


Advanced Data Compression

The QuickZip method is nice for simple zipping operations. For more sophisticated manipulation of an archive and its items, the Zip method can be used. Items can be added and removed using the Add and RemoveAt methods. Prior to zipping, individual items’ properties, such as Password and Comment, can be set. The zipped archive destination can be a file or stream, according to the application needs.

The following subtopics are addressed:

  • Advanced zipping to a compressed file
  • Advanced zipping to a compressed stream
  • Advanced asynchronous zipping

Advanced zipping to a compressed file

To zip files to a compressed file:

  1. Add the Archive component to a new form. For instructions on how to do this see, "Creating An Instance Of A Component Using Visual Studio .NET."
  2. Add a button to the form.
  3. Add files or wildcard collections to the archive. The code below demonstrates three different methods for adding files. Begin by placing this code in the click event of the button added to the form in step 2
    [Visual Basic]
'Add a file using the ArchiveItem constructor
Dim item As ArchiveItem = New ArchiveItem("c:\Test\file1.txt")
Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")
[C#]
//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");
archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");
  4. One of the benefits of separating the Zip and Add operations is that the archive can be manipulated prior to the compression. For example, an item’s comment can be set, or items can be removed from the archive using the RemoveAt method. To set the comment of the second item in the archive, and then remove the first item, place the following code directly after the code from step 3.
    [Visual Basic]
If Archive1.Count > 1 Then
   'Set the comment for the second item (index 1)
   Archive1(1).Comment = "This is the second item in the archive, soon to be first!"

   'Remove the first item (index 0)
   Archive1.RemoveAt(0)
End If

[C#]
if (archive1.Count > 1)
{
   //Set the comment for the second item (index 1)
   archive1[1].Comment = "This is the second item in the archive!";

   //Remove the first item (index 0)
   archive1.RemoveAt(0);
}
  5. Use the Zip method to create the zip file. Place the following code directly after the code from step 3.
    [Visual Basic]
Archive1.Zip("c:\test.zip")

[C#]
archive1.Zip("c:\\test.zip");
  6. Compile and run the application. After pressing the button, a new archive "c:\test.zip" with the files added from "c:\Test" should be found on disk.

Advanced zipping to a compressed stream

To zip files to a compressed stream:

  1. Follow steps 1, 2 , 3 and 4 above, for zipping to a compressed file.
  2. Create a stream to hold the compressed archive.
    3. [Visual Basic]
Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream()
[C#]
System.IO.MemoryStream stream = new System.IO.MemoryStream();
  3. Use the Zip method to save the compressed archive to memory.
    4. [Visual Basic]
Archive1.Zip(stream)
[C#]
archive1.Zip(stream);
  4. Show the length of the new compressed archive.
    5. [Visual Basic]
MessageBox.Show("The size of the compressed stream is " + stream.Length.ToString() + "bytes.")
[C#]
MessageBox.Show("The size of the compressed stream is " + stream.Length.ToString() + " bytes.");
  5. Compile and run the application. After pressing the button, a MessageBox with the size of the stream should be visible.

Advanced asynchronous zipping

To zip files asynchronously:

  1. Follow steps 1, 2, 3, and 4 above, for zipping to a compressed file.
  2. Use the asynchronous BeginZip method to create the zip file.
    3. [Visual Basic]
Archive1.BeginZip("c:\test.zip", Nothing)
[C#]
archive1.BeginZip("c:\\test.zip", null);
  3. Add code for the EndZip Event. When using the BeginXXX methods, you must have corresponding EndXXX events (see the Using Events In PowerTCP section for more details).
    4. [Visual Basic]
Private Sub Archive1_EndZip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndZip
   Try
      If (e.Exception Is Nothing) Then
         MessageBox.Show("Zip Complete!")
      Else
         MessageBox.Show(e.Exception.Message)
      End If
   Catch
   End Try
 End Sub

[C#]
private void archive1_EndZip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
   try
   {
      if (e.Exception == null)
         MessageBox.Show("Zip Complete!");
      else
         MessageBox.Show(e.Exception.Message);
   }
   catch {}
}
  4. Compile and run the application. After pressing the button, a new archive "c:\test.zip" with the files from "c:\Test" should be found on disk.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Advanced Data Decompression

The QuickUnzip method is nice for simple unzipping operations. For more sophisticated manipulation of an archive and its items, the Unzip method can be used. A compressed archive can be opened using the Open method. Individual items’ properties, such as Password and Comment, can then be set. The items can then be extracted individually to a path or stream using the Unzip method of ArchiveItem. Or the archive as a whole can be extracted to a path using Unzip method of Archive.

The following subtopics are addressed:

  • Advanced unzipping a compressed file
  • Advanced unzipping to a stream
  • Unzipping an Archive asynchronously
  • Unzipping an ArchiveItem asynchronously

Advanced unzipping a compressed file

To unzip an archive to a path on disk:

  1. Add the Archive component to a new form. For instructions on how to do this see, "Creating An Instance Of A Component Using Visual Studio .NET."
  2. Add a button to the form.
  3. Open the zip file using Open().
    [Visual Basic]
'Alternatively, a compressed stream could have been opened
Archive1.Open("c:\test.zip")
[C#]
//Alternatively, a compressed stream could have been opened
archive1.Open("c:\\test.zip");
  4. Specify the archive properties. For example, set the Password and Encryption properties to decrypt the entire collection. In the example to follow, all files in the zip archive "c:\test.zip" are extracted to the directory "c:\Test". The archived files’ paths are preserved during decompression, and all existing files will be overwritten. Begin by placing the code below in the click event of the button added to the form in step 2.
    [Visual Basic]
Archive1.PreservePath = True
Archive1.Overwrite = Always

[C#]
archive1.PreservePath = true;
archive1.Overwrite = Overwrite.Always;
  5. Use the Unzip method to extract files from the zip archive. Place the following code directly after the code from step 3.
    [Visual Basic]
Archive1.Unzip("c:\Test")

[C#]
archive1.Unzip("c:\\Test");
  6. 6. Compile and run the application. After pressing the button, the archived files contained in "c:\test.zip" will be extracted to the path "c:\Test".

Advanced unzipping to a stream

To unzip archive items to a path or stream:

  1. Follow steps 1, 2 and 3 above, for unzipping a compressed file or stream.
  2. Use the Unzip method to extract individual items to a stream or path on disk.
    3. [Visual Basic]
If Archive1.Count > 1 Then
   'Unzip the first item to a file, preserving its path
    Archive1(0).Unzip("c:\Test", True, Overwrite.Always)

    'Unzip the second item to a memory stream
    Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream()
    Archive1(1).Unzip(stream)
End If

[C#]
if (archive1.Count > 1)
{
   //Unzip the first item to a file, preserving its path
   archive1[0].Unzip("c:\\Test", true, Overwrite.Always);

   //Unzip the second item to a memory stream
   System.IO.MemoryStream stream = new System.IO.MemoryStream();
   archive1[1].Unzip(stream);
}
  3. Compile and run the application. After pressing the button, the first file in the compressed archive should be found in "c:\Test", and the second within the memory stream.

Unzipping an Archive asynchronously

To unzip an Archive asynchronously:

  1. Follow steps 1, 2 and 3 above for advanced unzipping a compressed file.
  2. Use the asynchronous BeginQuickUnzip method to extract the archived files.
    3. [Visual Basic]
Archive1.BeginQuickUnzip("c:\test.zip", "c:\Test", Nothing)
[C#]
archive1.BeginQuickUnzip("c:\\test.zip", "c:\\Test", null);
  3. Add code for the EndUnzip Event. When using the BeginXXX methods, you must have corresponding EndXXX events (see the Using Events In PowerTCP section for more details).
    4. [Visual Basic]
Private Sub Archive1_EndUnzip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndUnzip
   Try
      If (e.Exception Is Nothing) Then
         MessageBox.Show("Extraction Complete!")
      Else
         MessageBox.Show(e.Exception.Message)
      End If
   Catch
   End Try
End Sub

[C#]
private void archive1_EndUnzip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
   try
   {
      if (e.Exception == null)
         MessageBox.Show("Extraction Complete!");
      else
         MessageBox.Show(e.Exception.Message);
   }
   catch {}
}
  4. Compile and run the application. After pressing the button, the archived files contained in "c:\test.zip" will be extracted to the path "c:\Test".

Unzipping an ArchiveItem asynchronously

To unzip an ArchiveItem asynchronously:

  1. Follow the steps 1 and 3 above for unzipping an archive asynchronously. In place of step 2, use the following code.
    2. [Visual Basic]
If Archive1.Count > 1 Then
   'Unzip the first item to a file, preserving its path
   Archive1(0).BeginUnzip("c:\Test", True, Overwrite.Always, Nothing)

   'Unzip the second item to a memory stream
   Dim stream = New System.IO.MemoryStream()
   Archive1(1).BeginUnzip(stream, Nothing)
End If

[C#]
if (archive1.Count > 1)
{
   //Unzip the first item to a file, preserving its path
   archive1[0].BeginUnzip("c:\\Test", true, Overwrite.Always, null);

   //Unzip the second item to a memory stream
   System.IO.MemoryStream stream = new System.IO.MemoryStream();
   archive1[1].BeginUnzip(stream, null);
}
  2. Compile and run the application. After pressing the button, the first archived file contained in "c:\test.zip" will be extracted to the path “c:\Test” and the MemoryStream will contain the second archived item.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using Encryption

Items in an archive can be encrypted during the zipping process by specifying an encryption type (Encryption) and a password (Password). If an item’s password or encryption type is not explicitly set, the archive’s default properties will be used (Archive.DefaultEncryption and Password, respectively). When explicitly set, an item’s properties will always be used, regardless of when the archive’s default properties are set. The same properties can be set to decrypt items in a compressed archive prior to decompression.

The following subtopics are addressed:

  • Encrypting items in an archive.
  • Decrypting items in an archive

Encrypting items in an archive

To encrypt items in an archive:

  1. Add the Archive component to a new form. For instructions on how to do this see, "Creating An Instance Of A Component Using Visual Studio .NET."
  2. Add a button to the form.
  3. Add items to the archive.
    [Visual Basic]
' Add an item with Standard Encryption and a Password
Dim item1 As New ArchiveItem("c:\Test\file1.txt")
item1.Encryption = Standard
item1.Password = "lothlorien"
archive1.Add(item1)

' Add an item that will use the archive’s defaults
archive1.Add("c:\Test\file2.jpg")

' Add a non-encrypted item to archive - this item will not use the defaults
Dim item3 As New ArchiveItem("c:\Test\file3.doc")
item3.Encryption = None
item3.Password = "not used"  ' Not used, since there is no encryption
archive1.Add(item3)
[C#]
//Add an item with Standard Encryption and a Password
ArchiveItem item1 = new ArchiveItem("c:\\Test\\file1.txt");
item1.Encryption = Encryption.Standard;
item1.Password = "lothlorien";
archive1.Add(item1);

//Add an item that will use the archive’s defaults
archive1.Add("c:\\Test\\file2.jpg");

//Add a non-encrypted item to archive - this item will not use the defaults
ArchiveItem item3 = new ArchiveItem("c:\\Test\\file3.doc");
item3.Encryption = Encryption.None;
item3.Password = "not used";  //Not used, since there is no encryption
archive1.Add(item3);
  4. Set the Archive level properties.
    [Visual Basic]
' Set default encryption and password for archive
' Only the second item will use these values
archive1.DefaultEncryption = Standard
archive1.Password = "hobbiton"
[C#]
// Set default encryption and password for archive
// Only the second item will use these values
archive1.DefaultEncryption = Encryption.Standard;
archive1.Password = "hobbiton";
  5. Zip the archive. The first and second items will be encrypted. The second item will use the Archive values.
    [Visual Basic]
' Name      | Password   | Encryption
' -----------------------------------
' file1.txt | lothlorien | Standard
' file2.jpg | hobbiton   | Standard
' file3.doc | not used   | None
Archive1.Zip("c:\test.zip")
[C#]
// Name      | Password   | Encryption
// -----------------------------------
// file1.txt | lothlorien | Standard
// file2.jpg | hobbiton   | Standard
// file3.doc | not used   | None
archive1.Zip("c:\\test.zip");
  6. For demonstration purposes, explicitly set the second item and change Password. When the archive is zipped again, none of the items will use the new archive password.
    [Visual Basic]
' Explicitly set password of second item
archive1(1).Password = "rivendell"

' Set default encryption and password for archive
' This time, none of the items will use the defaults when zipped
archive1.DefaultEncryption = Standard
archive1.Password = "khazad-dum"

' Name      | Password   | Encryption
' file1.txt | lothlorien | Standard
' file2.jpg | rivendell  | Standard
' file3.doc | not used   | None
archive1.Zip("c:\Test\test.zip")
[C#]
// Explicitly set password of second item
archive1[1].Password = "rivendell";

//Set default encryption and password for archive
//This time, none of the items will use the defaults when zipped
archive1.DefaultEncryption = Encryption.Standard;
archive1.Password = "khazad-dum";

// Name      | Password   | Encryption
// file1.txt | lothlorien | Standard
// file2.jpg | rivendell  | Standard
// file3.doc | not used   | None
archive1.Zip("c:\\Test\\test.zip");

Decrypting items in an archive

To decrypt items in an archive:

  1. Add the Archive component to a new form. For instructions on how to do this see, "Creating An Instance Of A Component Using Visual Studio .NET."
  2. Add a button to the form.
  3. Open an archive with encrypted items
    [Visual Basic]
Archive1.Open("c:\test.zip")
[C#]
archive1.Open("c:\\test.zip");
  4. If all items in the archive use the same password, the Archive properties can be set prior to unzipping.
    [Visual Basic]
Archive1.DefaultEncryption = Standard
Archive1.Password = "allItemsUseTheSamePassword"
[C#]
archive1.DefaultEncryption = Encryption.Standard;
archive1.Password = "allItemsUseTheSamePassword";
  5. If individual items have different passwords, the ArchiveItem properties can be set prior to unzipping.
    6. [Visual Basic]
'Set the first item's password
Archive1(0).Encryption = Encryption.Standard
Archive1(0).Password = "myPasswordIsUnique"
[C#]
// Set the first item’s password
archive1[0].Encryption = Encryption.Standard;
archive1[0].Password = "myPasswordIsUnique";
  6. Unzip the archive.
    [Visual Basic]
Archive1.Unzip("c:\Test")
[C#]
archive1.Unzip("c:\\Test");

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using Self Extraction

The Archive component includes the capability of creating self-extracting archives. The Archive.SelfExtactConfiguration property provides a mechanism for creating archives that do not require the Zip Tool (or any other Unzip utility) to extract the files contained within.

Encrypting items in an archive

To encrypt items in an archive:

  1. Add the Archive component to a new form. For instructions on how to do this see, "Creating An Instance Of A Component Using Visual Studio .NET."
  2. Add a button to the form.
  3. Add files or wildcard collections to the archive.
    [Visual Basic]
Archive1.Add("c:\Test\*.txt")
[C#]
archive1.Add("c:\\Test\\*.txt");
  4. Set the self-extract configuration for the archive. There are five parameters:
    1. caption: The text to appear in the extractor’s title bar.
    2. path: The default extraction path
    3. enablePath: Allows the user to modify the extraction path.
    4. overwrite: Specifies whether the extractor should overwrite existing files by default.
    5. enableOverwrite: Allows the user to dictate whether existing files should be overwritten.
    [Visual Basic]
'This archive will always extract to the Test directory.  By default, existing files
'will be overwritten, but this can be changed by the end-user
Archive1.SelfExtractConfiguration = New SelfExtractConfiguration("This is my self-extracting archive!", "c:\Test", False, Overwrite.Always, True)

[C#]
//This archive will always extract to the Test directory.  By default, existing files
//will be overwritten, but this can be changed by the end-user
archive1.SelfExtractConfiguration = new SelfExtractConfiguration("This is my self-extracting archive!", "c:\\Test", false, Overwrite.Always, true);
  5. Zip the archive to disk.
    [Visual Basic]
Archive1.Zip("c:\mySelfExtractingArchive.exe")
[C#]
archive1.Zip("c:\\mySelfExtractingArchive.exe");
  6. When the resulting executable is distributed, the archived files can be extracted without the use of an unzipping utility.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using Events In PowerTCP

This topic discusses how to implement PowerTCP events within your application.

In This Section

Using Events within the Visual Studio .NET Environment
Describes how to use PowerTCP events within the Visual Studio .NET environment.
Using Events When a Component is Used as a Reference
Describes the extra steps required to use events when using a PowerTCP component as a reference.
Using EndXXX Events
Describes using EndXXX events when using asynchronous programming techniques.

Related Sections

Getting Started
Provides an overview of PowerTCP Zip Compression for .NET and discusses such topics as distribution, licensing, and support.
Using PowerTCP in VS.NET
Provides step-by-step instructions for creating a project using VS.NET, integrating PowerTCP Zip Compression for .NET, and creating a simple application.
Using the Archive Component
Discusses how to use the Archive component to compress/decompress files.
Reference
Provides a language/syntax reference for PowerTCP Zip Compression for .NET.
Samples
Describes the samples that are installed with PowerTCP Zip Compression for .NET.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using Events Within VS.NET

PowerTCP Zip Compression for .NET

Using Events within the Visual Studio .NET Environment

The Visual Studio .NET environment has built-in support for "wiring-up" and using component events, making their use simple.

To "wire-up" an event using the Visual Studio environment using VB.NET, use the following steps. (Steps for C# follow).

  1. Start a new VB.NET project and add a component to the form (see Creating an Instance of a Component Using Visual Studio .NET for information on how to do this). For this example, EndZip event of the Archive component is demonstrated.
  2. Navigate to View, and then select Code to switch to code view.
  3. From the "drop-down" boxes at the top of the Code Window, select the instance of the Archive component from the box on the left, and then the name of the event you would like to "wire-up" from the box on the right (see screenshot below).

  4. After doing this, the Visual Studio .NET environment will transparently create the necessary code to "wire-up" the event. The code should look similar to the following.
    5. Private Sub Archive1_EndZip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndZip
    ' Write event handling code here.
End Sub
  5. Now you can use the BeginZip method and the EndZip method will be raised upon completion of the asynchronous method call.

To "wire-up" an event using the Visual Studio environment using C#, use the following steps.

  1. Start a new C# project and add the Archive component control to the form (see Using a Component within Visual Studio .NET for information on how to do this).
  2. Click the component icon, created on the panel underneath the form.
  3. On the Properties Window click the "lightning bolt" icon to display all events for the Archive component.
  4. Double-click the event you wish to "wire-up" (see screenshot below).

  5. After doing this, the Visual Studio .NET environment will automatically create the necessary code to "wire-up" the event. The code should look similar to the following.
    6. private void archive1_EndZip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
    // Write event handling code here
}
  6. Now you can use the BeginZip method and the EndZip method will be raised upon completion of the asynchronous method call.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using Events When a Component is Used as a Reference

PowerTCP Zip Compression for .NET

Using Events When Using a Component as a Reference

If you are using the PowerTCP component as a reference (instead of adding it to the project as a component), and would like to use events, you must "wire-up" the event manually. This topic addresses how to do this using either VB.NET or C#. Note: You do NOT need to "wire-up" the events manually if you are dragging an instance of a PowerTCP component onto the form while using Visual Studio .NET. In this case all event subscription will be handled by the environment.

To use events when using a PowerTCP component as a class and creating a VB.NET Windows Application, use the following steps (steps for C# below).

  1. Start a new VB.NET project and add a PowerTCP component as a reference (see Adding a Component as a Reference within Visual Studio .NET for information of how to do this). In this example, the Archive component is used.
  2. Navigate to the View menu and then select Code to switch to code view.
  3. Create an instance of the Archive class. Be sure to use the WithEvents keyword such as in the following:
    4. Private WithEvents Archive1 As New Dart.PowerTCP.Zip.Archive()
  4. You must create a method that implements the appropriate delegate. The first step is to determine which event you would like to "wire-up". For the purposes of this walkthrough, the EndZip event will be used, although other events would work in a similar manner.
  5. Navigate to the EndZip event in the Reference section.
  6. The syntax definition for the appropriate language specifies which delegate is implemented by the event. For example the VB.NET syntax for the EndZip event is:
    7. public Event EndZip As EndEventHandler
    In other words, to "wire-up" the Archive.EndZip event, you must first create a method that implements the EndEventHandler delegate.
  7. Navigate to the reference listing for the Dart.PowerTCP.Zip.EndZip delegate. This listing will tell you what your event-handler method should look like. According to the EndZip delegate, your method must accept two arguments (an object and an EndEventArgs object) and return nothing, so create a method that does this. This method should look similar to the following:
    8. Private Sub MyEndZip(ByVal sender As Object, ByVal e As EndEventArgs)
   ' Write code to handle the event here.
End Sub
  8. Finally, the event handler must "subscribe" to the event. In VB.NET, this can simply be done by using the "Handles " keyword next to the event handler as such:
    9. Private Sub MyEndZip(ByVal sender As Object, ByVal e As EndEventArgs) Handles Archive1.EndZip
   ' Write code to handle the event here.
End Sub
  9. Alternatively, you can use the AddHandles keyword to "subscribe" an event handler to an event. This is done like so:
    10. AddHandler Archive1.EndZip, AddressOf Me.MyEndZip
  10. Now the BeginZip method can be used to asynchronously compress a file and the EndZip event will be raised upon completion of the method.

To use events when using a PowerTCP component as a reference and creating a C# Windows Application, use the following steps.

  1. Start a new C# project and add a PowerTCP component as a reference (see Adding a Component as a Reference within Visual Studio .NET for information of how to do this. In this example, the Archive component is used.
  2. Navigate to the View menu, and then select Code to switch to code view.
  3. Create an instance of the Archive class such as:
    4. private Dart.PowerTCP.Zip.Archive archive1 = new Dart.PowerTCP.Zip.Archive();
  4. Now you must create a method that implements the appropriate delegate. The first step is to determine which event you would like to "wire-up". For the purposes of this walkthrough, the EndZip event will be used, although other events would work in a similar manner.
  5. Navigate to the EndZip event in the Reference section.
  6. The syntax definition for the appropriate language specifies which delegate is implemented by the event. For example the C# syntax for the EndZip event is:
    7. public event EndEventHandler EndZip;
    In other words, to "wire-up" the Archive.EndZip event, you must first create a method that implements the EndEventHandler delegate.
  7. Navigate to the reference listing for the EndEventHandler delegate. This listing will tell you what your event-handler method should look like. According to the EndEventHandler delegate, your method must accept two arguments (an object and an EndEventArgs) and return void, so create a method that does this. This method should look similar to the following:
    8. private void MyEndZip(object sender, EndEventArgs e)
{
   // Write code to handle the event here.
}
  8. Finally, the event handler must "subscribe" to the event. In C#, this can be done as such (put this code in your form initialization):
    9. archive1.EndZip += new Dart.PowerTCP.Zip.EndEventHandler(this.MyEndZip);
  9. Now the BeginZip method can be used to asynchronously compress a file and the EndZip event will be raised upon completion of the method.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Using EndXXX Events

An EndXXX event is a generic term to describe any event used by PowerTCP Zip Compression for .NET that begins with the word "End". These events are reserved to notify the application of a process being completed. In addition, all EndXXX events are raised by the completion of a corresponding BeginXXX method. The EndXXX events used by the Archive component are as follows:

Event | Raised By | Purpose
Archive.EndZip Event | Completion of the Archive.BeginZip or Archive.BeginQuickZip method. | Notifies the application that a file, multiple files, or a stream has been compressed.
Archive.EndUnzip Event | Completion of the Archive.BeginUnzip or Archive.BeginQuickUnzip method. | Notifies the application that a file, multiple files, or a stream has been decompressed.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Reference

PowerTCP Zip Compression for .NET

PowerTCP Zip Compression for .NET Reference

This section contains reference documentation for all of the objects and classes that comprise Zip Compression for .NET. This section is intended solely for use as a class reference guide for use while building an application. It is NOT intended to give a "walkthrough" type description of usage. For a description of this type, see the higher-level topics.

In This Section

Dart.PowerTCP.Zip Namespace
Contains classes that support and enable integration of file compression/decompression .NET environment.

Related Sections

Getting Started
Provides an overview of PowerTCP Zip Compression for .NET and discusses such topics as distribution, licensing, and support.
Using PowerTCP in VS.NET
Provides step-by-step instructions for creating a project using VS.NET, integrating PowerTCP Zip Compression for .NET, and creating a simple application.
Using the Archive Component
Discusses how to use the Archive component to compress/decompress files.
Using Events in PowerTCP
Discusses how to use the events provided by PowerTCP Zip Compression for .NET.
Samples
Describes the samples that are installed with PowerTCP Zip Compression for .NET.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Dart.PowerTCP.Zip

PowerTCP Zip Compression for .NET

Dart.PowerTCP.Zip Namespace

Classes

Class | Description
Archive | Represents an archive of files, directories, and Streams.
ArchiveItem | Represents an individual item inside an Archive.
BusyException | Thrown whenever a method is called to perform an operation when an operation is already in progress.
DiskEventArgs | Provides status information when removable media is used
EndEventArgs | Abstract base class for all event argument objects that mark the completion of an asynchronous method.
ExceptionEventArgs | Arguments for the Exception event.
ProgressEventArgs | The status of the current on-going operation
SelfExtractConfiguration | Used to configure how the items in a self extract zip archive will be extracted as files.
SpanConfiguration | Used to configure how a multi-part zip archive is spanned over multiple disks or split on a hard drive.
SpanProgressEventArgs | The status of the current on-going spanning operation
ZipException | Used to catch the run-time exceptions during any operation of the Archive component.

Delegates

Delegate | Description
DiskEventHandler | The delegate for the Disk event.
EndEventHandler | The delegate for the completion events.
ExceptionEventHandler | The delegate for the Exception event.
ProgressEventHandler | The delegate for the Progress event.
SpanProgressEventHandler | The delegate for the SpanProgress event.

Enumerations

Enumeration | Description
CompressionLevel | Enumerates the compression levels.
CompressionMethod | Enumerates the different compression types
Encryption | Enumerates the type of encryption to use or in use
ErrorCode | Enumerates the error codes.
Format | Enumerates the compression format the Archive component currently supports.
Overwrite | Enumerates values which determine how files are overwritten.
Status | Enumerates values which describe the current state of the compression operation.

Send comments on this topic.

© 2003 Dart Communications. All rights reserved.


Archive Class

Represents an archive of files, directories, and Streams.

For a list of all members of this type, see Archive Members.

System.Object
MarshalByRefObject
Component
Archive

[Visual Basic]
Public Class Archive
Inherits Component
Implements ICollection, IEnumerable, IListSource
[C#]
public class Archive : Component, ICollection, IEnumerable, IListSource

Remarks

Use the Archive component to compress files and Streams, and to decompress compressed archives. The Archive component provides the standard ICollection and IListSource interfaces, and contains ArchiveItem objects which represent an item (file, Stream, or directory) within the archive. Compression and decompression operations are provided on the Archive level (if you wish to apply operations to all items in the Archive) and decompression on the ArchiveItem level (if you wish to fine-tune operations).

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Archive Members | Dart.PowerTCP.Zip Namespace


Archive Members

Public Instance Constructors

Archive Constructor Initializes a new instance of Archive.

Public Instance Properties

Busy | Returns true if a method is currently in use.
Comment | Gets or sets the comment for the entire collection.
CompressionLevel | Gets or sets the compression level for data compression.
Container (inherited from Component) |
ContainsListCollection | Gets a value indicating whether the collection is a collection of IList objects.
Count | The number of ArchiveItem objects within the Archive.
DefaultCompressionMethod | Gets or sets the default compression algorithm used for data compression.
DefaultEncryption | Gets or sets the encryption algorithm used for the the entire collection..
DoEvents | Gets or sets a value that controls the processing of events during blocking method calls.
ExcludePattern | Gets or sets the files to exclude when using wildcards.
Format | The compression format of the items in the archive.
IncludeSubs | Gets or sets whether subdirectories are included when using wildcards.
IsSynchronized | Gets a value indicating whether access to the ICollection is synchronized (thread-safe).
Item | Gets or sets the object at the specified index.
Overwrite | Gets or sets a value which determines how files are overwritten when decompressing files.
Password | Gets or sets the encryption password for the entire archive.
PreservePath | Gets or sets a value which determines if file paths are preserved when compressing or decompressing.
ProgressSize | Gets or sets the frequency to raise the Progress event.
SelfExtractConfiguration | Gets or sets a SelfExtractConfiguration object, which is used to define the specification of a self-extraction operation.
Site (inherited from Component) |
SpanConfiguration | Gets or sets a SpanConfiguration object, which is used to span or split an archive over multiple volumes.
SynchronizingObject | Set this object to automatically control thread marshalling between worker threads and the main UI thread.
SyncRoot | Gets an object that can be used to synchronize access to the Archive.
Tag | Gets or sets an object reference that can be used to associate this instance with any other.
TempFileDirectory | Gets or sets a value indicating the directory to store any temporary files created during compression operations.
VolumeLabel | Gets or sets the volume label.

Public Instance Methods

Abort | Aborts the current operation
Add | Overloaded. Adds an item or items to the archive.
BeginQuickUnzip | Overloaded. Asynchronously open a compressed archive and decompress in one step.
BeginQuickZip | Overloaded. Asynchronously add items and zip in one step.
BeginUnzip | Asynchronously decompress the items in the current collection
BeginZip | Overloaded. Asynchronously compress the items in the current collection and generate a zip archive that is written to a Stream.
Clear | Removes all elements from the ArrayList.
CopyTo | Copies the entire ArrayList to a compatible one-dimensional Array, starting at the specified index of the target array.
CreateObjRef (inherited from MarshalByRefObject) | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
Dispose (inherited from Component) |
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetEnumerator | Returns an enumerator for the collection.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetLifetimeService (inherited from MarshalByRefObject) | Retrieves the current lifetime service object that controls the lifetime policy for this instance.
GetList | Returns an IList that can be bound to a data source from an object that does not implement an IList itself.
GetType (inherited from Object) | Gets the Type of the current instance.
InitializeLifetimeService (inherited from MarshalByRefObject) | Obtains a lifetime service object to control the lifetime policy for this instance.
Insert | Overloaded. Inserts one or more items into the collection starting from the specified index.
Open | Overloaded. Opens a compressed archive and populates the collection to reflect the items in the compressed archive.
QuickUnzip | Overloaded. Opens a compressed archive and decompress in one step.
QuickZip | Overloaded. Adds a file or files and compresses in one step.
RemoveAt | Removes an element at the specified index from the collection.
RemoveRange | Removes a range of elements from an ArrayList or collection.
Reset | Removes the elements in the collection and reset all of the properties of the collection to their defaults.
ToString (inherited from Component) |
Unzip | Decompresses the items in the current collection to the specified directory
Zip | Overloaded. Compresses the items in the current collection and generates a compressed archive.

Public Instance Events

BusyChanged | This event is raised when the Busy property in the Archive component gets changed.
Disk | This event is raised when a removable media volume is needed during a spanning process.
Disposed (inherited from Component) |
EndUnzip | This event is raised when an asynchronous Unzip operation completes
EndZip | This event is raised when an asynchronous zip operation completes
Exception | This event is raised when an Exception condition occurs during an Archive-level operation.
Progress | This event is raised periodically to indicate the progress of the current compression or decompression activity.
SpanProgress | This event is raised periodically to indicate the progress of a spanning operation.

See Also

Archive Class | Dart.PowerTCP.Zip Namespace


Archive Constructor

Initializes a new instance of Archive.

[Visual Basic]
Public Sub New()
[C#]
public Archive();

Remarks

The default constructor initializes a new instance of Archive.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive Properties

The properties of the Archive class are listed below. For a complete list of Archive class members, see the Archive Members topic.

Public Instance Properties

Busy | Returns true if a method is currently in use.
Comment | Gets or sets the comment for the entire collection.
CompressionLevel | Gets or sets the compression level for data compression.
Container (inherited from Component) |
ContainsListCollection | Gets a value indicating whether the collection is a collection of IList objects.
Count | The number of ArchiveItem objects within the Archive.
DefaultCompressionMethod | Gets or sets the default compression algorithm used for data compression.
DefaultEncryption | Gets or sets the encryption algorithm used for the the entire collection..
DoEvents | Gets or sets a value that controls the processing of events during blocking method calls.
ExcludePattern | Gets or sets the files to exclude when using wildcards.
Format | The compression format of the items in the archive.
IncludeSubs | Gets or sets whether subdirectories are included when using wildcards.
IsSynchronized | Gets a value indicating whether access to the ICollection is synchronized (thread-safe).
Item | Gets or sets the object at the specified index.
Overwrite | Gets or sets a value which determines how files are overwritten when decompressing files.
Password | Gets or sets the encryption password for the entire archive.
PreservePath | Gets or sets a value which determines if file paths are preserved when compressing or decompressing.
ProgressSize | Gets or sets the frequency to raise the Progress event.
SelfExtractConfiguration | Gets or sets a SelfExtractConfiguration object, which is used to define the specification of a self-extraction operation.
Site (inherited from Component) |
SpanConfiguration | Gets or sets a SpanConfiguration object, which is used to span or split an archive over multiple volumes.
SynchronizingObject | Set this object to automatically control thread marshalling between worker threads and the main UI thread.
SyncRoot | Gets an object that can be used to synchronize access to the Archive.
Tag | Gets or sets an object reference that can be used to associate this instance with any other.
TempFileDirectory | Gets or sets a value indicating the directory to store any temporary files created during compression operations.
VolumeLabel | Gets or sets the volume label.

See Also

Archive Class | Dart.PowerTCP.Zip Namespace


Archive.Busy Property

Returns true if a method is currently in use.

[Visual Basic]
Public ReadOnly Property Busy As Boolean
[C#]
public bool Busy {get;}

Property Value

true if a method is currently is use, otherwise false

Remarks

When used in PowerTCP Zip Compression for .NET, this property provides protection against accessing a method that is still processing a command.

When used in an Internet communications component, this property provides protection against sending commands over a busy socket. For example, if the PowerTCP component is engaged in sending or receiving data, and another method is called that requires use of the same socket, a BusyException is thrown.

The Object.BusyChanged event is raised whenever the value of this property changes.

For Internet communications components, check this property within your code if you feel a new operation could be attempted over a socket that is already engaged in sending or receiving data. This property is also useful for displaying socket status to the user. For example, a "stoplight" could be part of the user interface that would be red when the Object.Busy property is true, and green when false.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Comment Property

Gets or sets the comment for the entire collection.

[Visual Basic]
Public Property Comment As String
[C#]
public string Comment {get; set;}

Property Value

A string representing the comment for the zip file.

Remarks

When an archive is loaded, this property returns any comments associated with the compressed archive. Setting this property sets the comment for the compressed output.

To get or set the comments for individual items within the archive, use the Comment property.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.CompressionLevel Property

Gets or sets the compression level for data compression.

[Visual Basic]
Public Property CompressionLevel As CompressionLevel
[C#]
public CompressionLevel CompressionLevel {get; set;}

Property Value

A CompressionLevel value specifying the compression level for data compression. The default value is CompressionLevel.Medium

Remarks

Note that the higher the compression level, the slower the process. An application should choose an appropriate value according to its needs.

If no compression is desired, set Archive.DefaultCompressionMethod or ArchiveItem.CompressionMethod to CompressionMethod.Store.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.ContainsListCollection Property

Gets a value indicating whether the collection is a collection of IList objects.

[Visual Basic]
NotOverridable Public ReadOnly Property ContainsListCollection As Boolean Implements _
   IListSource.ContainsListCollection
[C#]
public bool ContainsListCollection {get;}

Implements

IListSource.ContainsListCollection

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Count Property

The number of ArchiveItem objects within the Archive.

[Visual Basic]
NotOverridable Public ReadOnly Property Count As Integer Implements _
   ICollection.Count
[C#]
public int Count {get;}

Property Value

An integer representing the number of ArchiveItem objects within the Archive.

Implements

ICollection.Count

Remarks

When the Archive component represents a compressed archive that contains a volume label, the volume label is available using the VolumeLabel property and is not an item in the collection or represented by Count.

Example

[Visual Basic, C#] The following example demonstrates unzipping from an individual ArchiveItem.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

If (Archive1.Count > 1) Then

    'Unzip the first item in the collection to a file, preserving its path
    Archive1(0).Unzip("c:\Test", True, Overwrite.Always)

    'Unzip the second item in the collection to a memory stream
    Dim stream = New System.IO.MemoryStream()
    Archive1(1).Unzip(stream)
End If

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

if (archive1.Count > 1)
{
    //Unzip the first item in the collection to a file, preserving its path
    archive1[0].Unzip("c:\\Test", true, Overwrite.Always);

    //Unzip the second item in the collection to a memory stream
    System.IO.MemoryStream stream = new System.IO.MemoryStream();
    archive1[1].Unzip(stream);
}

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.DefaultCompressionMethod Property

Gets or sets the default compression algorithm used for data compression.

[Visual Basic]
Public Property DefaultCompressionMethod As CompressionMethod
[C#]
public CompressionMethod DefaultCompressionMethod {get; set;}

Property Value

A CompressionMethod value specifying the method used for data compression. The default value is Deflate.

Remarks

During a collection level compression operation, if ArchiveItem.CompressionMethod is set, the value of DefaultCompressionMethod is ignored when compressing that item. If ArchiveItem.CompressionMethod is not set, the value of DefaultCompressionMethod is used during a compression operation.

Setting Store will archive the data to a zip file without performing any compression.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.DefaultEncryption Property

Gets or sets the encryption algorithm used for the the entire collection..

[Visual Basic]
Public Property DefaultEncryption As Encryption
[C#]
public Encryption DefaultEncryption {get; set;}

Property Value

An Encryption value specifying the encryption algorithm. The default value is None.

Remarks

The algorithm specified using this property is applied to the entire archive. For customizing the encryption algorithm for an individual item in the collection, use the Encryption property of the ArchiveItem object.

An application should check this property to verify if a password is required to unzip this archive.

If the Encryption property is set to a value other than None and the Password property is not set during a zip operation, an Exception event will be raised for every item that does not match.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.DoEvents Property

Gets or sets a value that controls the processing of events during blocking method calls.

[Visual Basic]
Public Property DoEvents As Boolean
[C#]
public bool DoEvents {get; set;}

Property Value

true if user-interface events should be processed during synchronous method calls; otherwise, false. The default value is true.

Remarks

When performing a synchronous (blocking) method, PowerTCP will process user-interface events (such as window painting) if this property is set to true AND the current thread has an event message queue. If no message queue is present (such as on an ASP page or under any worker thread), the value of this property has no effect. This property is used only for synchronous methods. Object.DoEvents is not needed if using asynchronous methods because the asynchronous method will execute on a different thread, allowing the UI thread to continue working unblocked.

For example, this property is beneficial when an interactive application is being used and the user may want to abort a currently processing operation by clicking an "Abort" button. If Object.DoEvents is set to false, this will not be possible. Set the Object.DoEvents property to true and the application will respond to other events (such as button clicks) during synchronous operations.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.ExcludePattern Property

Gets or sets the files to exclude when using wildcards.

[Visual Basic]
Public Property ExcludePattern As String
[C#]
public string ExcludePattern {get; set;}

Property Value

A string value. The default is an empty string.

Remarks

If you wish to exclude files from the QuickZip method, Insert method, or Add method set this property to a string value (including wildcards, if desired) specifying the file(s) to exclude.

Only a single exclusion pattern can be specified for an operation.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Format Property

The compression format of the items in the archive.

[Visual Basic]
Public ReadOnly Property Format As Format
[C#]
public Format Format {get;}

Property Value

Format value, specifying the archive format. There is no default value, as this property is initialized when an archive is opened.

Remarks

This value is available after an archive has been loaded using Open. If a gZip archive is loaded and Zip is called, Zip is used for the compression operation.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.IncludeSubs Property

Gets or sets whether subdirectories are included when using wildcards.

[Visual Basic]
Public Property IncludeSubs As Boolean
[C#]
public bool IncludeSubs {get; set;}

Property Value

A boolean value indicating whether to include subdirectories when using wildcards. Defaults to false.

Remarks

If you wish to include subdirectories when using the QuickZip method set this property to true.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.IsSynchronized Property

Gets a value indicating whether access to the ICollection is synchronized (thread-safe).

[Visual Basic]
NotOverridable Public ReadOnly Property IsSynchronized As Boolean Implements _
   ICollection.IsSynchronized
[C#]
public bool IsSynchronized {get;}

Property Value

true if access to the Archive is synchronized (thread-safe); otherwise, false.

Implements

ICollection.IsSynchronized

Remarks

This property is inherited from the ICollection interface.

The SyncRoot property returns an object, which can be used to synchronize access to the Archive.

Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads could still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Item Property

Gets or sets the object at the specified index.

[Visual Basic]
Public Default Property Item( _
   ByVal index As Integer _
) As ArchiveItem
[C#]
public ArchiveItem this[
   int index
] {get; set;}

Parameters

index
The zero-based index of the element to get or set.

Property Value

The object at the specified index.

Remarks

This property provides the ability to access a specific element in the collection by using the following syntax:

                    myArchive[index].

Example

[Visual Basic, C#] The following example demonstrates unzipping from an individual ArchiveItem.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

If (Archive1.Count > 1) Then

    'Unzip the first item in the collection to a file, preserving its path
    Archive1(0).Unzip("c:\Test", True, Overwrite.Always)

    'Unzip the second item in the collection to a memory stream
    Dim stream = New System.IO.MemoryStream()
    Archive1(1).Unzip(stream)
End If

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

if (archive1.Count > 1)
{
    //Unzip the first item in the collection to a file, preserving its path
    archive1[0].Unzip("c:\\Test", true, Overwrite.Always);

    //Unzip the second item in the collection to a memory stream
    System.IO.MemoryStream stream = new System.IO.MemoryStream();
    archive1[1].Unzip(stream);
}

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Overwrite Property

Gets or sets a value which determines how files are overwritten when decompressing files.

[Visual Basic]
Public Property Overwrite As Overwrite
[C#]
public Overwrite Overwrite {get; set;}

Property Value

An Overwrite value specifying how to overwrite files. The default value is Never, indicating files are not overwritten.

Remarks

This property is only used when the destination parameter of the Unzip or QuickUnzip specifies a destination directory.

This property is only used for decompression.

Example

[Visual Basic, C#] The following example demonstrates using QuickUnzip and specifying specific options. Only QuickUnzip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path when unzipping
Archive1.PreservePath = True

'Overwrite any existing files
Archive1.Overwrite = Overwrite.Always

'Unzip all the files to c:\test
Archive1.QuickUnzip("c:\test.zip", "c:\Test")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path when unzipping
archive1.PreservePath = true;

//Overwrite any existing files
archive1.Overwrite = Overwrite.Always;

//Unzip all the files to c:\test
archive1.QuickUnzip("c:\\test.zip", "c:\\Test");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Password Property

Gets or sets the encryption password for the entire archive.

[Visual Basic]
Public Property Password As String
[C#]
public string Password {get; set;}

Property Value

A string value specifying the encryption password for the entire archive. The default value is an empty string.

Remarks

When creating a compressed archive, this property will be propagated to the Password property of each individual ArchiveItem object in the collection. For customizing the password for an individual item in the archive, use the Password property of the ArchiveItem object.

To determine if a password is required when decompressing an archive, check the Encryption property.

If a password is specified, but encryption is None, an Exception event will be raised.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.PreservePath Property

Gets or sets a value which determines if file paths are preserved when compressing or decompressing.

[Visual Basic]
Public Property PreservePath As Boolean
[C#]
public bool PreservePath {get; set;}

Property Value

true to preserve paths; false otherwise. The default value is false.

Remarks

When zipping, if this property is true, the path information will be stored in the resultant zip archive.

When unzipping, if this property is set to true, path information is used to create the directory structure under the specified destination directory. If the given zip archive does not contain the path information for the file items, this property has no effect for unzipping.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.ProgressSize Property

Gets or sets the frequency to raise the Progress event.

[Visual Basic]
Public Property ProgressSize As Integer
[C#]
public int ProgressSize {get; set;}

Property Value

An integer specifying the frequency to raise the Progress event. The default value is 1024.

Remarks

The Progress event is raised in the frequency specified by ProgressSize as the bytes are processed during a compression or decompression operation. The maximum value is 32768 (32 megabytes) and the minimum is 256 (kilobytes).

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.SelfExtractConfiguration Property

Gets or sets a SelfExtractConfiguration object, which is used to define the specification of a self-extraction operation.

[Visual Basic]
Public Property SelfExtractConfiguration As SelfExtractConfiguration
[C#]
public SelfExtractConfiguration SelfExtractConfiguration {get; set;}

Property Value

A SelfExtractConfiguration object, null if self-extraction is not required. The default value is null.

Remarks

To create a self-extracting file, create a new SelfExtractConfiguration object. Set the properties of this object to configure the characteristics of the self-extracted file. Then, set this property equal to that object.

The default value of null means no self-extracted file will be created during a zip operation.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.SpanConfiguration Property

Gets or sets a SpanConfiguration object, which is used to span or split an archive over multiple volumes.

[Visual Basic]
Public Property SpanConfiguration As SpanConfiguration
[C#]
public SpanConfiguration SpanConfiguration {get; set;}

Property Value

A SpanConfiguration object if spanning is used, null if spanning is not used. The default value is null.

Remarks

To use spanning, create a new SpanConfiguration object. Set the properties of this object to configure how spanning occurs. Then, set this property equal to that object.

The default value of null means no spanning or splitting will be used during a zip operation.

Please note that a spanned archive can only be opened for unzipping. In other words, Add, Remove, Insert and Zip operations can not be applied to an existing spanned archive.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.SynchronizingObject Property

Set this object to automatically control thread marshalling between worker threads and the main UI thread.

[Visual Basic]
Public Property SynchronizingObject As ISynchronizeInvoke
[C#]
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject {get; set;}

Property Value

If used, the main UI thread object; null if unused.

Remarks

Any application that (1) uses multithreading (for example, an application which uses an asynchronous BeginXXX method) and (2) must update a shared UI element on the main UI thread (such as a ListView object) from one of these worker threads must set this property to the value of the main UI thread object. If the application meets both of these requirements and this property is NOT set, you may see strange behavior in your application (such as strange exceptions or improper UI element values).

If you do not know whether or not you need to use this property, simply take the failsafe approach when programming Windows applications and always set this property to the Main Form object. If any thread marshalling has to occur between a worker thread and the UI thread, it will occur automatically.

NOTE for server implementations: If you are using a PowerTCP server component to build a server application, you do not want to set this property (as it will cause the server application to become single-threaded). Instead, you want to use the Control.BeginInvoke method to thread-marshall to the main UI thread (see any of the installed sample server applications for an example of this).

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.SyncRoot Property

Gets an object that can be used to synchronize access to the Archive.

[Visual Basic]
NotOverridable Public ReadOnly Property SyncRoot As Object Implements _
   ICollection.SyncRoot
[C#]
public object SyncRoot {get;}

Property Value

An object that can be used to synchronize to the Archive.

Implements

ICollection.SyncRoot

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Tag Property

Gets or sets an object reference that can be used to associate this instance with any other.

[Visual Basic]
Public Property Tag As Object
[C#]
public object Tag {get; set;}

Property Value

Any object that is associated with the component; null if no objects are associated with the component. Any object that is associated with the object, null if no objects are associated with the object

Remarks

Use this property to associate any type derived from Object class with the component. A common use for the Tag property is to store data that is closely associated with the component.

Use this property to associate any object with the object.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.TempFileDirectory Property

Gets or sets a value indicating the directory to store any temporary files created during compression operations.

[Visual Basic]
Public Property TempFileDirectory As String
[C#]
public string TempFileDirectory {get; set;}

Property Value

A string representing the directory to store temporary files. The default is the system default directory.

Remarks

All temporary files are normally deleted after use (even if Abort() is used), but files could accumulate if abnormal program termination occurs.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.VolumeLabel Property

Gets or sets the volume label.

[Visual Basic]
Public Property VolumeLabel As String
[C#]
public string VolumeLabel {get; set;}

Property Value

A string representing the volume label. The default value is an empty string.

Remarks

When using Open on an archive that contains a volume label the VolumeLabel is set.

When using Unzip and the VolumeLabel contains a value, that value is not written to the disk.

When Using Zip and the VolumeLabel contains a value, the VolumeLabel value is preserved in the archive using the PKZIP format.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive Methods

The methods of the Archive class are listed below. For a complete list of Archive class members, see the Archive Members topic.

Public Instance Methods

Abort | Aborts the current operation
Add | Overloaded. Adds an item or items to the archive.
BeginQuickUnzip | Overloaded. Asynchronously open a compressed archive and decompress in one step.
BeginQuickZip | Overloaded. Asynchronously add items and zip in one step.
BeginUnzip | Asynchronously decompress the items in the current collection
BeginZip | Overloaded. Asynchronously compress the items in the current collection and generate a zip archive that is written to a Stream.
Clear | Removes all elements from the ArrayList.
CopyTo | Copies the entire ArrayList to a compatible one-dimensional Array, starting at the specified index of the target array.
CreateObjRef (inherited from MarshalByRefObject) | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
Dispose (inherited from Component) |
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetEnumerator | Returns an enumerator for the collection.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetLifetimeService (inherited from MarshalByRefObject) | Retrieves the current lifetime service object that controls the lifetime policy for this instance.
GetList | Returns an IList that can be bound to a data source from an object that does not implement an IList itself.
GetType (inherited from Object) | Gets the Type of the current instance.
InitializeLifetimeService (inherited from MarshalByRefObject) | Obtains a lifetime service object to control the lifetime policy for this instance.
Insert | Overloaded. Inserts one or more items into the collection starting from the specified index.
Open | Overloaded. Opens a compressed archive and populates the collection to reflect the items in the compressed archive.
QuickUnzip | Overloaded. Opens a compressed archive and decompress in one step.
QuickZip | Overloaded. Adds a file or files and compresses in one step.
RemoveAt | Removes an element at the specified index from the collection.
RemoveRange | Removes a range of elements from an ArrayList or collection.
Reset | Removes the elements in the collection and reset all of the properties of the collection to their defaults.
ToString (inherited from Component) |
Unzip | Decompresses the items in the current collection to the specified directory
Zip | Overloaded. Compresses the items in the current collection and generates a compressed archive.

See Also

Archive Class | Dart.PowerTCP.Zip Namespace


Archive.Abort Method

Aborts the current operation

[Visual Basic]
Public Sub Abort()
[C#]
public void Abort();

Remarks

If Abort is called during an Add operation, any items already added before Abort is called will not be removed from the Archive collection.

Exceptions

Exception Type | Condition
ZipException | An exception will be raised with the code ErrorCode.Abort to alert the application that an operation has been aborted.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Add Method

PowerTCP Zip Compression for .NET

Archive.Add Method

Adds an item or items to the archive.

Overload List

Adds an item or items to the archive.

public void Add(string);

Adds an item or items to the archive.

public void Add(Stream);

Adds an item or items to the archive.

public void Add(ArchiveItem);

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Add Method (ArchiveItem)

Adds an item or items to the archive.

[Visual Basic]
Overloads Public Sub Add( _
   ByVal value As ArchiveItem _
)
[C#]
public void Add(
   ArchiveItem value
);

Parameters

value
An ArchiveItem containing the data to add to the archive.

Remarks

Use this method to add an ArchiveItem to the archive. Compress the data in the item by using the Zip method.

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'zip the data
Archive1.Zip("c:\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Add Overload List


Archive.Add Method (Stream)

Adds an item or items to the archive.

[Visual Basic]
Overloads Public Sub Add( _
   ByVal source As Stream _
)
[C#]
public void Add(
   Stream source
);

Parameters

source
A .NET Stream containing the data to add to the archive.

Remarks

Use this method to add a Stream (which could be a FileStream, MemoryStream, or any other type of .NET Stream) to the archive. Compress the Stream by using the Zip method.

The source stream is not altered by the Archive component. For example, after reading, the Archive component will not close the source stream.

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'zip the data
Archive1.Zip("c:\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Add Overload List


Archive.Add Method (String)

Adds an item or items to the archive.

[Visual Basic]
Overloads Public Sub Add( _
   ByVal source As String _
)
[C#]
public void Add(
   string source
);

Parameters

source
A file and path of a file to add to the archive, or a file and path that includes wildcards specifying multiple files to add to the archive.

Remarks

Use this method to add a file or multiple files (using wildcards) to the archive. Compress the added files by using the Zip method.

If using wildcards, ExcludePattern and IncludeSubs can be used to fine tune the operation.

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'zip the data
Archive1.Zip("c:\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Add Overload List


BeginQuickUnzip Method

PowerTCP Zip Compression for .NET

Archive.BeginQuickUnzip Method

Asynchronously open a compressed archive and decompress in one step.

Overload List

Asynchronously open a compressed archive and decompress in one step.

public IAsyncResult BeginQuickUnzip(string,string,object);

Asynchronously open a compressed archive and decompress in one step.

public IAsyncResult BeginQuickUnzip(Stream,string,object);

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.BeginQuickUnzip Method (Stream, String, Object)

Asynchronously open a compressed archive and decompress in one step.

[Visual Basic]
Overloads Public Function BeginQuickUnzip( _
   ByVal source As Stream, _
   ByVal destination As String, _
   ByVal state As Object _
) As IAsyncResult
[C#]
public IAsyncResult BeginQuickUnzip(
   Stream source,
   string destination,
   object state
);

Parameters

source
The Stream that contains the compressed data.
destination
A directory where decompressed files will be stored.
state
User state information. Use this to pass data to your EndXXX event handler.

Return Value

An IAsyncResult that represents the asynchronous operation, which could still be pending.

Remarks

This method is a quick and easy way to use the Archive component to decompress a given compressed Stream to the specified destination directory in one step. It combines the two operations of Open and Unzip.

The PreservePath property determines whether to preserve the paths. The Overwrite property determines whether and how an existing file will be overwritten. By default, the paths will not be preserved and the overwrite choice is Never. The Password property is used for decrypting the encrypted items.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
InvalidOperationException | BeginXXX method used without providing an EndXXX event handler.
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.BeginQuickUnzip Overload List


Archive.BeginQuickUnzip Method (String, String, Object)

Asynchronously open a compressed archive and decompress in one step.

[Visual Basic]
Overloads Public Function BeginQuickUnzip( _
   ByVal source As String, _
   ByVal destination As String, _
   ByVal state As Object _
) As IAsyncResult
[C#]
public IAsyncResult BeginQuickUnzip(
   string source,
   string destination,
   object state
);

Parameters

source
The Stream that contains the compressed data.
destination
A directory where decompressed files will be stored.
state
User state information. Use this to pass data to your EndXXX event handler.

Return Value

An IAsyncResult that represents the asynchronous operation, which could still be pending.

Remarks

This method is a quick and easy way to use the Archive component to decompress a given compressed Stream to the specified destination directory in one step. It combines the two operations of Open and Unzip.

The PreservePath property determines whether to preserve the paths. The Overwrite property determines whether and how an existing file will be overwritten. By default, the paths will not be preserved and the overwrite choice is Never. The Password property is used for decrypting the encrypted items.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
InvalidOperationException | BeginXXX method used without providing an EndXXX event handler.
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.BeginQuickUnzip Overload List


BeginQuickZip Method

PowerTCP Zip Compression for .NET

Archive.BeginQuickZip Method

Asynchronously add items and zip in one step.

Overload List

Asynchronously add items and zip in one step.

public IAsyncResult BeginQuickZip(string,Stream,object);

Asynchronously add items and zip in one step.

public IAsyncResult BeginQuickZip(string,string,object);

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.BeginQuickZip Method (String, Stream, Object)

Asynchronously add items and zip in one step.

[Visual Basic]
Overloads Public Function BeginQuickZip( _
   ByVal source As String, _
   ByVal destination As Stream, _
   ByVal state As Object _
) As IAsyncResult
[C#]
public IAsyncResult BeginQuickZip(
   string source,
   Stream destination,
   object state
);

Parameters

source
The names or wildcards of the files to be compressed.
destination
A Stream that is to contain the compressed data.
state
User state information. Use this to pass data to your EndXXX event handler.

Return Value

An IAsyncResult that represents the asynchronous operation, which could still be pending.

Remarks

This method is a quick and easy way to use the Archive component to compress a given file or files to the specified destination Stream. It combines the two operations of Add and Zip.

The Password and Archive.Encryption properties are used for data encryption during the BeginQuickZip operation. The PreservePath property determines whether to preserve paths for each file item. The IncludeSubs property determines whether to include the subdirectories. The ExcludePattern property determines the files to exclude.

Note that data is written to the Stream at the current position and will not be reset to 0.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
InvalidOperationException | BeginXXX method used without providing an EndXXX event handler.
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates using BeginQuickZip for an asynchronous zip operation. Only BeginQuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the asynchrnonous compression operation
Archive1.BeginQuickZip("c:\Test\*.txt", "c:\test.zip", Nothing)

Private Sub Archive1_EndZip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndZip
    Try
        If e.Exception Is Nothing Then
            MessageBox.Show("Zip Complete!")
        Else
            MessageBox.Show(e.Exception.Message)
        End If

    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption
archive1.DefaultEncryption = Encryption.Standard;
//Specify the password

archive1.Password = "testme";

//Perform the asynchrnonous compression operation
archive1.BeginQuickZip("c:\\Test\\*.txt", "c:\\test.zip", null);

private void archive1_EndZip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
    try
    {
        if (e.Exception == null)
            MessageBox.Show("Zip Complete!");
        else
            MessageBox.Show(e.Exception.Message);
    }
    catch {}

}

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.BeginQuickZip Overload List


Archive.BeginQuickZip Method (String, String, Object)

Asynchronously add items and zip in one step.

[Visual Basic]
Overloads Public Function BeginQuickZip( _
   ByVal source As String, _
   ByVal destination As String, _
   ByVal state As Object _
) As IAsyncResult
[C#]
public IAsyncResult BeginQuickZip(
   string source,
   string destination,
   object state
);

Parameters

source
The names or wildcards of the files to be compressed.
destination
A filename that will contain the compressed data.
state
User state information. Use this to pass data to your EndXXX event handler.

Return Value

An IAsyncResult that represents the asynchronous operation, which could still be pending.

Remarks

This method is a quick and easy way to use the Archive component to compress a given file or files to a specified destination file. It combines the two operations of Add and Zip.

The Password and Archive.Encryption properties are used for data encryption during the BeginQuickZip operation. The PreservePath property determines whether to preserve paths for each file item. The IncludeSubs property determines whether to include the subdirectories. The ExcludePattern property determines the files to exclude.

During a zip operation, the source files are never altered in any manner unless the destination file has the same name as the source file. In that case, the file loaded with Open will be updated to contain the results of the zip operation. To prevent any unanticipated damage, the zip operation updates the destination only after a zip operation completes successfully.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
InvalidOperationException | BeginXXX method used without providing an EndXXX event handler.
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates using BeginQuickZip for an asynchronous zip operation. Only BeginQuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the asynchrnonous compression operation
Archive1.BeginQuickZip("c:\Test\*.txt", "c:\test.zip", Nothing)

Private Sub Archive1_EndZip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndZip
    Try
        If e.Exception Is Nothing Then
            MessageBox.Show("Zip Complete!")
        Else
            MessageBox.Show(e.Exception.Message)
        End If

    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption
archive1.DefaultEncryption = Encryption.Standard;
//Specify the password

archive1.Password = "testme";

//Perform the asynchrnonous compression operation
archive1.BeginQuickZip("c:\\Test\\*.txt", "c:\\test.zip", null);

private void archive1_EndZip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
    try
    {
        if (e.Exception == null)
            MessageBox.Show("Zip Complete!");
        else
            MessageBox.Show(e.Exception.Message);
    }
    catch {}

}

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.BeginQuickZip Overload List


Archive.BeginUnzip Method

Asynchronously decompress the items in the current collection

[Visual Basic]
Public Function BeginUnzip( _
   ByVal destination As String, _
   ByVal state As Object _
) As IAsyncResult
[C#]
public IAsyncResult BeginUnzip(
   string destination,
   object state
);

Parameters

destination
A directory that will contain the decompressed files.
state
User state information. Use this to pass data to your EndXXX event handler.

Return Value

An IAsyncResult that represents the asynchronous operation, which could still be pending.

Remarks

The PreservePath property determines whether to preserve the paths. The Overwrite property determines whether and how an existing file will be overwritten. By default, the paths will not be preserved and the overwrite choice is Never.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates loading a compressed file and asynchronously unzipping the contents.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

'Preserve the path structure and overwrite any existing files.
Archive1.PreservePath = True
Archive1.Overwrite = Overwrite.Always

'Begin an asynchronous unzip process
Archive1.BeginUnzip("c:\test", Nothing)

Private Sub Archive1_EndUnzip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndUnzip
    Try
        'Check for any zip operation exceptions
        If e.Exception Is Nothing Then
            MessageBox.Show("Extraction Complete!")
        Else
            MessageBox.Show(e.Exception.Message)
        End If

    Catch

    End Try
End Sub
[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

//Preserve the path structure and overwrite any existing files.
archive1.PreservePath = true;
archive1.Overwrite = Overwrite.Always;

//Begin an asynchronous unzip process
archive1.BeginUnzip("c:\\test",null);

private void archive1_EndUnzip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
    try
    {
        if (e.Exception == null)
            MessageBox.Show("Extraction Complete!");
        else
            MessageBox.Show(e.Exception.Message);
    }
    catch {}

}

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


BeginZip Method

PowerTCP Zip Compression for .NET

Archive.BeginZip Method

Asynchronously compress the items in the current collection and generate a zip archive that is written to a Stream.

Overload List

Asynchronously compress the items in the current collection and generate a zip archive that is written to a Stream.

public IAsyncResult BeginZip(Stream,object);

Asynchronously compress the items in the current collection and generate a zip archive that is written to the specified file.

public IAsyncResult BeginZip(string,object);

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.BeginZip Method (Stream, Object)

Asynchronously compress the items in the current collection and generate a zip archive that is written to a Stream.

[Visual Basic]
Overloads Public Function BeginZip( _
   ByVal destination As Stream, _
   ByVal state As Object _
) As IAsyncResult
[C#]
public IAsyncResult BeginZip(
   Stream destination,
   object state
);

Parameters

destination
A Stream that will contain the compressed data.
state
User state information. Use this to pass data to your EndXXX event handler.

Return Value

An IAsyncResult that represents the asynchronous operation, which could still be pending.

Remarks

The Password and Archive.Encryption properties are used for data encryption during the BeginZip operation.

Data is written to the Stream at the current position and is not reset to 0.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates adding files to the collection and asynchronously zipping them.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'Start the zipping processes
Archive1.BeginZip("c:\test.zip", Nothing)

Private Sub Archive1_EndZip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndZip
    Try
        If e.Exception Is Nothing Then
            MessageBox.Show("Zip Complete!")
        Else
            MessageBox.Show(e.Exception.Message)
        End If

    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Start the zipping processes
archive1.BeginZip("c:\\test.zip", null);

private void archive1_EndZip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
    try
    {
        if (e.Exception == null)
            MessageBox.Show("Zip Complete!");
        else
            MessageBox.Show(e.Exception.Message);
    }
    catch {}

}

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.BeginZip Overload List


Archive.BeginZip Method (String, Object)

Asynchronously compress the items in the current collection and generate a zip archive that is written to the specified file.

[Visual Basic]
Overloads Public Function BeginZip( _
   ByVal destination As String, _
   ByVal state As Object _
) As IAsyncResult
[C#]
public IAsyncResult BeginZip(
   string destination,
   object state
);

Parameters

destination
A filename that will contain the compressed data.
state
User state information. Use this to pass data to your EndXXX event handler.

Return Value

An IAsyncResult that represents the asynchronous operation, which could still be pending.

Remarks

The Password and Archive.Encryption properties are used for data encryption during the BeginZip operation. The PreservePath property determines whether to preserve paths for each file item; the IncludeSubs property determines whether to include the subdirectories; the ExcludePattern property determines the files to exclude.

During a zip operation, the source files are never altered in any manner unless the destination file has the same name as the source file. In that case, the file loaded with Open will be updated to contain the results of the zip operation. To prevent any unanticipated damage, the zip operation updates the destination only after a zip operation completes successfully.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates adding files to the collection and asynchronously zipping them.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'Start the zipping processes
Archive1.BeginZip("c:\test.zip", Nothing)

Private Sub Archive1_EndZip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndZip
    Try
        If e.Exception Is Nothing Then
            MessageBox.Show("Zip Complete!")
        Else
            MessageBox.Show(e.Exception.Message)
        End If

    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Start the zipping processes
archive1.BeginZip("c:\\test.zip", null);

private void archive1_EndZip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
    try
    {
        if (e.Exception == null)
            MessageBox.Show("Zip Complete!");
        else
            MessageBox.Show(e.Exception.Message);
    }
    catch {}

}

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.BeginZip Overload List


Archive.Clear Method

Removes all elements from the ArrayList.

[Visual Basic]
Public Sub Clear()
[C#]
public void Clear();

Remarks

Count is set to zero.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.CopyTo Method

Copies the entire ArrayList to a compatible one-dimensional Array, starting at the specified index of the target array.

[Visual Basic]
NotOverridable Public Sub CopyTo( _
   ByVal array As Array, _
   ByVal index As Integer _
) Implements _
   ICollection.CopyTo
[C#]
public void CopyTo(
   Array array,
   int index
);

Parameters

array
The one-dimensional Array that is the destination of the elements copied from ArrayList. The Array must have zero-based indexing.
index
The zero-based index in array at which copying begins.

Implements

ICollection.CopyTo

Remarks

The specified array must be of a compatible type.

This method uses Array.Copy to copy the elements.

Exceptions

Exception Type | Condition
ArgumentNullException | array is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeException | Index is less than zero.
ArgumentException | array is multidimensional.
InvalidCastException | The type of the source ArrayList cannot be cast automatically to the type of the destination array.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.GetEnumerator Method

Returns an enumerator for the collection.

[Visual Basic]
NotOverridable Public Function GetEnumerator() As IEnumerator Implements _
   IEnumerable.GetEnumerator
[C#]
public IEnumerator GetEnumerator();

Return Value

An IEnumerator for the entire collection.

Implements

IEnumerable.GetEnumerator

Remarks

Enumerators only allow reading the data in the collection. Enumerators cannot be used to modify the underlying collection.

Initially, the enumerator is positioned before the first element in the collection. IEnumerator.Reset also brings the enumerator back to this position. At this position, calling IEnumerator.Current throws an exception. Therefore, you must call IEnumerator.MoveNext to advance the enumerator to the first element of the collection before reading the value of IEnumerator.Current.

IEnumerator.Current returns the same object until either IEnumerator.MoveNext or IEnumerator.Reset is called. IEnumerator.MoveNext sets IEnumerator.Current to the next element.

After the end of the collection is passed, the enumerator is positioned after the last element in the collection, and calling IEnumerator.MoveNext returns false. If the last call to IEnumerator.MoveNext returned false, calling IEnumerator.Current throws an exception. To set IEnumerator.Current to the first element of the collection again, you can call IEnumerator.Reset followed by IEnumerator.MoveNext.

This method is used by the "foreach" construct.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.GetList Method

Returns an IList that can be bound to a data source from an object that does not implement an IList itself.

[Visual Basic]
NotOverridable Public Function GetList() As IList Implements _
   IListSource.GetList
[C#]
public IList GetList();

Implements

IListSource.GetList

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Insert Method

PowerTCP Zip Compression for .NET

Archive.Insert Method

Inserts one or more items into the collection starting from the specified index.

Overload List

Inserts one or more items into the collection starting from the specified index.

public void Insert(int,string);

Inserts one or more items into the collection starting from the specified index.

public void Insert(int,Stream);

Inserts one or more items into the collection starting from the specified index.

public void Insert(int,ArchiveItem);

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Insert Method (Int32, ArchiveItem)

Inserts one or more items into the collection starting from the specified index.

[Visual Basic]
Overloads Public Sub Insert( _
   ByVal index As Integer, _
   ByVal value As ArchiveItem _
)
[C#]
public void Insert(
   int index,
   ArchiveItem value
);

Parameters

index
A zero-based index at which an ArchiveItem will be inserted.
value
An ArchiveItem that is to be added to the Archive.

Remarks

This overload is intended to insert an ArchiveItem object into the collection.

Please note that a spanned archive is not allowed to add or delete any items.

Exceptions

Exception Type | Condition
ArgumentOutOfRangeException | index is not a valid index.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Insert Overload List


Archive.Insert Method (Int32, Stream)

Inserts one or more items into the collection starting from the specified index.

[Visual Basic]
Overloads Public Sub Insert( _
   ByVal index As Integer, _
   ByVal source As Stream _
)
[C#]
public void Insert(
   int index,
   Stream source
);

Parameters

index
A zero-based index at which a Stream will be inserted.
source
A Stream that is to be added to the Archive.

Remarks

This overload is intended for inserting streams into the collection.

Please note that a spanned archive is not allowed to add or delete any items.

Exceptions

Exception Type | Condition
ArgumentOutOfRangeException | index is not a valid index.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Insert Overload List


Archive.Insert Method (Int32, String)

Inserts one or more items into the collection starting from the specified index.

[Visual Basic]
Overloads Public Sub Insert( _
   ByVal index As Integer, _
   ByVal source As String _
)
[C#]
public void Insert(
   int index,
   string source
);

Parameters

index
A zero-based index at which a file or files will be inserted.
source
A file or wildcard that is to be added to the Archive.

Remarks

Please note that a spanned archive is not allowed to add or delete any items.

Exceptions

Exception Type | Condition
ArgumentOutOfRangeException | index is not a valid index.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Insert Overload List


Open Method

PowerTCP Zip Compression for .NET

Archive.Open Method

Opens a compressed archive and populates the collection to reflect the items in the compressed archive.

Overload List

Opens a compressed archive and populates the collection to reflect the items in the compressed archive.

public void Open(string);

Opens a compressed archive and populates the collection to reflect the items in the compressed archive.

public void Open(Stream);

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Open Method (Stream)

Opens a compressed archive and populates the collection to reflect the items in the compressed archive.

[Visual Basic]
Overloads Public Sub Open( _
   ByVal zipArchive As Stream _
)
[C#]
public void Open(
   Stream zipArchive
);

Parameters

zipArchive
The compressed Stream to be opened.

Remarks

This overload is intended to open Stream-based classes and populate the Archive collection.

Please note that an Open operation will clear any pre-existing items in the collection.

If a zip operation is executed with a stream destination, and that destination stream is the same as the zipArchive stream, the zipArchive stream will be overwritten with the resultant compressed data.

Example

[Visual Basic, C#] The following example demonstrates loading a compressed file and unzipping the file.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

'Preserve the path structure and overwrite any existing files.
Archive1.PreservePath = True
Archive1.Overwrite = Overwrite.Always

'Unzip to c:\test
Archive1.Unzip("c:\Test")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

//Preserve the path structure and overwrite any existing files.
archive1.PreservePath = true;
archive1.Overwrite = Overwrite.Always;

//Unzip to c:\test
archive1.Unzip("c:\\Test");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Open Overload List


Archive.Open Method (String)

Opens a compressed archive and populates the collection to reflect the items in the compressed archive.

[Visual Basic]
Overloads Public Sub Open( _
   ByVal zipArchive As String _
)
[C#]
public void Open(
   string zipArchive
);

Parameters

zipArchive
The name of the compressed file to be opened.

Remarks

This overload is intended to open compressed files and populate the Archive collection.

Please note that an Open operation will clear any pre-existing items in the collection. Also, the zipArchive specified in the open method will be locked as read-only until the Clear method is called.

Example

[Visual Basic, C#] The following example demonstrates loading a compressed file and unzipping the file.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

'Preserve the path structure and overwrite any existing files.
Archive1.PreservePath = True
Archive1.Overwrite = Overwrite.Always

'Unzip to c:\test
Archive1.Unzip("c:\Test")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

//Preserve the path structure and overwrite any existing files.
archive1.PreservePath = true;
archive1.Overwrite = Overwrite.Always;

//Unzip to c:\test
archive1.Unzip("c:\\Test");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Open Overload List


QuickUnzip Method

PowerTCP Zip Compression for .NET

Archive.QuickUnzip Method

Opens a compressed archive and decompress in one step.

Overload List

Opens a compressed archive and decompress in one step.

public void QuickUnzip(string,string);

Opens a compressed archive and decompress in one step.

public void QuickUnzip(Stream,string);

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.QuickUnzip Method (Stream, String)

Opens a compressed archive and decompress in one step.

[Visual Basic]
Overloads Public Sub QuickUnzip( _
   ByVal source As Stream, _
   ByVal destination As String _
)
[C#]
public void QuickUnzip(
   Stream source,
   string destination
);

Parameters

source
The compressed Stream.
destination
A directory path where decompressed files will be stored.

Remarks

This method is a quick and easy way to use the Archive component to decompress a compressed Stream to a specified destination directory in one step. It combines the two operations of Open and Unzip.

The PreservePath property determines whether to preserve the paths. The Overwrite property determines whether and how an existing file will be overwritten. By default, the paths will not be preserved and the overwrite choice is Never. The Password property is used for decrypting the encrypted items.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates using QuickUnzip with a stream destination.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path when unzipping
Archive1.PreservePath = True

'Overwrite any existing files
Archive1.Overwrite = Overwrite.Always

'Create a new stream with compressed data
Dim stream = New System.IO.FileStream("c:\test.zip", System.IO.FileMode.Open)

'Unzip the data in the stream to c:\test
Archive1.QuickUnzip(stream, "c:\Test")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path when unzipping
archive1.PreservePath = true;

//Overwrite any existing files
archive1.Overwrite = Overwrite.Always;

//Create a new stream with compressed data
System.IO.FileStream stream = new System.IO.FileStream("c:\\test.zip", System.IO.FileMode.Open);

//unzip the data in the stream to c:\test
archive1.QuickUnzip(stream, "c:\\Test");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.QuickUnzip Overload List


Archive.QuickUnzip Method (String, String)

Opens a compressed archive and decompress in one step.

[Visual Basic]
Overloads Public Sub QuickUnzip( _
   ByVal source As String, _
   ByVal destination As String _
)
[C#]
public void QuickUnzip(
   string source,
   string destination
);

Parameters

source
The name of the compressed file.
destination
A directory path where decompressed files will be stored.

Remarks

This method is a quick and easy way to use the Archive component to decompress a given compressed archive to a specified destination directory in one step. It combines the two operations of Open and Unzip.

The PreservePath property determines whether to preserve the paths. The Overwrite property determines whether and how an existing file will be overwritten. By default, the paths will not be preserved and the overwrite choice is Never. The Password property is used for decrypting the encrypted items.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates using QuickUnzip and specifying specific options. Only QuickUnzip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path when unzipping
Archive1.PreservePath = True

'Overwrite any existing files
Archive1.Overwrite = Overwrite.Always

'Unzip all the files to c:\test
Archive1.QuickUnzip("c:\test.zip", "c:\Test")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path when unzipping
archive1.PreservePath = true;

//Overwrite any existing files
archive1.Overwrite = Overwrite.Always;

//Unzip all the files to c:\test
archive1.QuickUnzip("c:\\test.zip", "c:\\Test");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.QuickUnzip Overload List


QuickZip Method

PowerTCP Zip Compression for .NET

Archive.QuickZip Method

Adds a file or files and compresses in one step.

Overload List

Adds a file or files and compresses in one step.

public void QuickZip(string,Stream);

Adds a file or files and compress in one step.

public void QuickZip(string,string);

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.QuickZip Method (String, Stream)

Adds a file or files and compresses in one step.

[Visual Basic]
Overloads Public Sub QuickZip( _
   ByVal source As String, _
   ByVal destination As Stream _
)
[C#]
public void QuickZip(
   string source,
   Stream destination
);

Parameters

source
The names or wildcards of the files to be compressed.
destination
A Stream that is to contain the compressed data.

Remarks

This method is a quick and easy way to use the Archive component to compress a given file or files to a specified destination stream. It combines the two operations of Add and Zip.

The Password and Archive.Encryption properties are used for data encryption during the QuickZip operation. The PreservePath property determines whether to preserve paths for each file item. The IncludeSubs property determines whether to include the subdirectories. The ExcludePattern property determines the files to exclude.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip with a stream as a destination.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Create a stream
Dim stream = New System.IO.MemoryStream()

'Quickzip to the stream
Archive1.QuickZip("c:\Test\*.*", stream)

MessageBox.Show("The size of the compressed stream is " + stream.Length.ToString() + " bytes.")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

 //Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption
archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Create a stream
System.IO.MemoryStream stream = new System.IO.MemoryStream();

//Quickzip to the stream
archive1.QuickZip("c:\\Test\\*.*", stream);

MessageBox.Show("The size of the compressed stream is " + stream.Length.ToString() + " bytes.");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.QuickZip Overload List


Archive.QuickZip Method (String, String)

Adds a file or files and compress in one step.

[Visual Basic]
Overloads Public Sub QuickZip( _
   ByVal source As String, _
   ByVal destination As String _
)
[C#]
public void QuickZip(
   string source,
   string destination
);

Parameters

source
The names or wildcards of the files to be compressed.
destination
A filename that will contain the compressed data.

Remarks

This method is a quick and easy way to use the Archive component to compress a given file or files to a specified destination file. It combines the two operations of Add and Zip.

The Password and Archive.Encryption properties are used for data encryption during the QuickZip operation. The PreservePath property determines whether to preserve paths for each file item. The IncludeSubs property determines whether to include the subdirectories. The ExcludePattern property determines the files to exclude.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.QuickZip Overload List


Archive.RemoveAt Method

Removes an element at the specified index from the collection.

[Visual Basic]
Public Sub RemoveAt( _
   ByVal index As Integer _
)
[C#]
public void RemoveAt(
   int index
);

Parameters

index
The zero-based index of the element to remove.

Remarks

When an item is removed, the elements that follow the removed element move up to occupy the vacated spot.

Exceptions

Exception Type | Condition
ArgumentOutOfRangeException | index is less than zero. -or- index is equal to or greater than Count.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.RemoveRange Method

Removes a range of elements from an ArrayList or collection.

[Visual Basic]
Public Sub RemoveRange( _
   ByVal index As Integer, _
   ByVal count As Integer _
)
[C#]
public void RemoveRange(
   int index,
   int count
);

Parameters

index
The zero-based starting index of the range of elements to remove.
count
The number of elements to remove.

Remarks

In collections of contiguous elements, such as lists, the elements that follow the removed element move up to occupy the vacated spot. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hashtable.

Exceptions

Exception Type | Condition
ArgumentOutOfRangeException | Index is less than zero.
ArgumentException | array is multidimensional.
NotSupportedException | The ArrayList is read-only.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Reset Method

Removes the elements in the collection and reset all of the properties of the collection to their defaults.

[Visual Basic]
Public Sub Reset()
[C#]
public void Reset();

Remarks

This method clears the Archive collection and resets all properties to their default value. To only clear the Archive collection, use Clear.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Unzip Method

Decompresses the items in the current collection to the specified directory

[Visual Basic]
Public Sub Unzip( _
   ByVal destination As String _
)
[C#]
public void Unzip(
   string destination
);

Parameters

destination
A directory that will contain the decompressed data files.

Remarks

The PreservePath property determines whether to preserve the paths and the Overwrite property determines whether and how an existing file will be overwritten. By default, the paths will not be preserved and the overwrite choice is Never. The Password property is used for decrypting the encrypted items.

If you would like to unzip an item to a stream, Unzip can be used for such a purpose.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates loading a compressed file and unzipping the file.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

'Preserve the path structure and overwrite any existing files.
Archive1.PreservePath = True
Archive1.Overwrite = Overwrite.Always

'Unzip to c:\test
Archive1.Unzip("c:\Test")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

//Preserve the path structure and overwrite any existing files.
archive1.PreservePath = true;
archive1.Overwrite = Overwrite.Always;

//Unzip to c:\test
archive1.Unzip("c:\\Test");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Zip Method

PowerTCP Zip Compression for .NET

Archive.Zip Method

Compresses the items in the current collection and generates a compressed archive.

Overload List

Compresses the items in the current collection and generates a compressed archive.

public void Zip(Stream);

Compresses the items in the current collection and generates a compressed archive.

public void Zip(string);

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Zip Method (Stream)

Compresses the items in the current collection and generates a compressed archive.

[Visual Basic]
Overloads Public Sub Zip( _
   ByVal destination As Stream _
)
[C#]
public void Zip(
   Stream destination
);

Parameters

destination
A stream that will contain the compressed data.

Remarks

The Password and Archive.Encryption properties are used for data encryption during the Zip operation. The PreservePath property determines whether to preserve paths for each file item. The IncludeSubs property determines whether to include the subdirectories. The ExcludePattern property determines the files to exclude.

If a stream is used with the Open method and the Zip destination is the same stream, the original source stream will be overwritten beginning at position 0.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'zip the data
Archive1.Zip("c:\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Zip Overload List


Archive.Zip Method (String)

Compresses the items in the current collection and generates a compressed archive.

[Visual Basic]
Overloads Public Sub Zip( _
   ByVal destination As String _
)
[C#]
public void Zip(
   string destination
);

Parameters

destination
A file that will contain the compressed data.

Remarks

The Password and Archive.Encryption properties are used for data encryption during the Zip operation. The PreservePath property determines whether to preserve paths for each file item. The IncludeSubs property determines whether to include the subdirectories. The ExcludePattern property determines the files to exclude.

If an error occurs for an individual item during this operation, the Exception Event will be raised.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'zip the data
Archive1.Zip("c:\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Zip Overload List


Archive Events

The events of the Archive class are listed below. For a complete list of Archive class members, see the Archive Members topic.

Public Instance Events

BusyChanged | This event is raised when the Busy property in the Archive component gets changed.
Disk | This event is raised when a removable media volume is needed during a spanning process.
Disposed (inherited from Component) |
EndUnzip | This event is raised when an asynchronous Unzip operation completes
EndZip | This event is raised when an asynchronous zip operation completes
Exception | This event is raised when an Exception condition occurs during an Archive-level operation.
Progress | This event is raised periodically to indicate the progress of the current compression or decompression activity.
SpanProgress | This event is raised periodically to indicate the progress of a spanning operation.

See Also

Archive Class | Dart.PowerTCP.Zip Namespace


Archive.BusyChanged Event

This event is raised when the Busy property in the Archive component gets changed.

[Visual Basic]
Public Event BusyChanged As EventHandler
[C#]
public event EventHandler BusyChanged;

Remarks

Use this event to help identify when a zip or unzip operation has started or ended. See the Busy property for more information.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Disk Event

This event is raised when a removable media volume is needed during a spanning process.

[Visual Basic]
Public Event Disk As DiskEventHandler
[C#]
public event DiskEventHandler Disk;

Event Data

The event handler receives an argument of type DiskEventArgs containing data related to this event. The following DiskEventArgs properties provide information specific to this event.

Property | Description
DiskNumber | The disk number needed during a spanning operation
Exception | The exception information when a spanning operation has a problem with a disk.
IgnoreLabel | Gets or sets whether to ignore volume label information when using removable media.

Remarks

The Archive.DiskEventArgs will report the volume number expected for the spanning operation. Not all spanned archives contain proper volume labels that identify the proper disk order. In that case, IgnoreLabel can be used to read a spanned disk even if a proper volume label is not present.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.EndUnzip Event

This event is raised when an asynchronous Unzip operation completes

[Visual Basic]
Public Event EndUnzip As EndEventHandler
[C#]
public event EndEventHandler EndUnzip;

Event Data

The event handler receives an argument of type EndEventArgs containing data related to this event. The following EndEventArgs properties provide information specific to this event.

Property | Description
Exception | Gets the Exception that occurred.
State | Returns any state information included with this event.

Remarks

if an error occurs during the unzip operation, Exception can be checked for the exception.

Example

[Visual Basic, C#] The following example demonstrates loading a compressed file and asynchronously unzipping the contents.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

'Preserve the path structure and overwrite any existing files.
Archive1.PreservePath = True
Archive1.Overwrite = Overwrite.Always

'Begin an asynchronous unzip process
Archive1.BeginUnzip("c:\test", Nothing)

Private Sub Archive1_EndUnzip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndUnzip
    Try
        'Check for any zip operation exceptions
        If e.Exception Is Nothing Then
            MessageBox.Show("Extraction Complete!")
        Else
            MessageBox.Show(e.Exception.Message)
        End If

    Catch

    End Try
End Sub
[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

//Preserve the path structure and overwrite any existing files.
archive1.PreservePath = true;
archive1.Overwrite = Overwrite.Always;

//Begin an asynchronous unzip process
archive1.BeginUnzip("c:\\test",null);

private void archive1_EndUnzip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
    try
    {
        if (e.Exception == null)
            MessageBox.Show("Extraction Complete!");
        else
            MessageBox.Show(e.Exception.Message);
    }
    catch {}

}

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.EndZip Event

This event is raised when an asynchronous zip operation completes

[Visual Basic]
Public Event EndZip As EndEventHandler
[C#]
public event EndEventHandler EndZip;

Event Data

The event handler receives an argument of type EndEventArgs containing data related to this event. The following EndEventArgs properties provide information specific to this event.

Property | Description
Exception | Gets the Exception that occurred.
State | Returns any state information included with this event.

Remarks

if an error occurs during the unzip operation, Archive.EndEventArgs.Exception can be checked for the exception.

Example

[Visual Basic, C#] The following example demonstrates adding files to the collection and asynchronously zipping them.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'Start the zipping processes
Archive1.BeginZip("c:\test.zip", Nothing)

Private Sub Archive1_EndZip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndZip
    Try
        If e.Exception Is Nothing Then
            MessageBox.Show("Zip Complete!")
        Else
            MessageBox.Show(e.Exception.Message)
        End If

    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Start the zipping processes
archive1.BeginZip("c:\\test.zip", null);

private void archive1_EndZip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
    try
    {
        if (e.Exception == null)
            MessageBox.Show("Zip Complete!");
        else
            MessageBox.Show(e.Exception.Message);
    }
    catch {}

}

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Exception Event

This event is raised when an Exception condition occurs during an Archive-level operation.

[Visual Basic]
Public Event Exception As ExceptionEventHandler
[C#]
public event ExceptionEventHandler Exception;

Event Data

The event handler receives an argument of type ExceptionEventArgs containing data related to this event. The following ExceptionEventArgs properties provide information specific to this event.

Property | Description
Exception | The exception condition that occurred during the processing of an item in the collection.
Index | The index of the ArchiveItem object in the Archive object that the exception condition occurs.

Remarks

The Exception event data is stored in an ExceptionEventArgs object. See the Enumeration Archive.ErrorCode for the complete list of the exception conditions defined in the Archive component. The Exception event is only raised when an Exception occurs at the Archive level. An Exception that occurs at the ArchiveItem level will be raised to the application directly.

When an Exception occurs, the ArchiveItem.Exception will be set with the Exception.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.Progress Event

This event is raised periodically to indicate the progress of the current compression or decompression activity.

[Visual Basic]
Public Event Progress As ProgressEventHandler
[C#]
public event ProgressEventHandler Progress;

Event Data

The event handler receives an argument of type ProgressEventArgs containing data related to this event. The following ProgressEventArgs properties provide information specific to this event.

Property | Description
Item | The ArchiveItem object currently being processed.
ItemIndex | The index of the ArchiveItem object currently being processed.
ProcessedItemBytes | The total uncompressed bytes of the ArchiveItem being processed.
ProcessedTotalBytes | The cumulative number of bytes that have been processed in the Archive collection during the current operation.
Status | The status of the current on-going operation.
TotalBytes | The total bytes to be processed for this operation.

Remarks

A ProgressEventArgs object is passed to the event handler, containing details about the operation underway.

When a span operation is underway, once data has been compressed, the Progress event will no longer be raised and the SpanProgress event should be used to track the progress of the splitting operation.

Not using the Progress event can improve the performance of your application as marshalling data from the worker thread to the UI thread will use available resources.

Example

[Visual Basic, C#] The following example demonstrates using the Progress event.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

Private Sub Archive1_Progress(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.ProgressEventArgs) Handles Archive1.Progress
    Try
        'Set the progress bar and status when fires
        'prgItem is the progress bar for an individual item and prgTotal is for all the items.
        Select Case (e.Status)

            Case Status.Unzipping
                'Show item progress
                prgItem.Maximum = e.Item.Size
                prgItem.Value = e.processedItemBytes

                'Show total progress
                prgTotal.Maximum = e.TotalBytes
                prgTotal.Value = e.ProcessedTotalBytes

                Debug.WriteLine("Unzipping " + e.Item.Name)
            Case Status.EndUnzip
                prgTotal.Value = prgTotal.Maximum
        End Select
    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

private void archive1_Progress(object sender, Dart.PowerTCP.Zip.ProgressEventArgs e)
        {
            try
            {
                //Set the progress bar and status when fires
                //prgItem is the progress bar for an individual item and prgTotal is for all the items.
                switch (e.Status)
                {
                    case Status.Unzipping:
                        //Show item progress
                        prgItem.Maximum = (int)e.Item.Size;
                        prgItem.Value = (int)e.ProcessedItemBytes;

                        //Show total progress
                        prgTotal.Maximum = (int)e.TotalBytes;
                        prgTotal.Value = (int)e.ProcessedTotalBytes;

                        Debug.WriteLine("Unzipping " + e.Item.Name);
                        break;
                    case Status.EndUnzip:
                        prgTotal.Value = prgTotal.Maximum;
                        break;
                }
            }
            catch {}
        }

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


Archive.SpanProgress Event

This event is raised periodically to indicate the progress of a spanning operation.

[Visual Basic]
Public Event SpanProgress As SpanProgressEventHandler
[C#]
public event SpanProgressEventHandler SpanProgress;

Event Data

The event handler receives an argument of type SpanProgressEventArgs containing data related to this event. The following SpanProgressEventArgs properties provide information specific to this event.

Property | Description
FileNumber | The part number or the volume number that is currently undergoing a spanning operation.
Length | The total bytes of the compressed data to be spanned.
Position | The number of bytes that have been spanned.

Remarks

A SpanProgressEventArgs object is passed to the event handler, containing details about the operation underway.

When a spanning operation is requested, the SpanProgress Event will be raised after the Progress event has reached 100%. This indicates that the compression portion of the spanning operation has completed and the part splitting operation has begun.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace


ArchiveItem Class

Represents an individual item inside an Archive.

For a list of all members of this type, see ArchiveItem Members.

System.Object
ArchiveItem

[Visual Basic]
Public Class ArchiveItem
[C#]
public class ArchiveItem

Remarks

This class enables an application to access and manipulate the data of an individual file within an archive. It also provides support for data decompression at the file level.

Changing any ArchiveItem property will not impact the source. Changes only have impact on the destination. For example, changing Name will not change the name of the original source file, but after a zip operation the file will be archived with the name specified in the Name property.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem Members

Public Instance Constructors

ArchiveItem Overloaded. Initialize a new instance of the ArchiveItem class.

Public Instance Properties

Attributes | Gets or sets the file attributes for the ArchiveItem object.
Comment | Gets or sets the comment associated with the item.
CompressedSize | The compressed size of the item.
CompressionMethod | Gets or sets the compression algorithm used for data compression on this item.
CompressionRatio | The compression percentage of the item
CRC | The check-sum value for the item.
Encryption | Gets or sets the encryption algorithm type applied to this item.
LastModified | Gets a DateTime object representing the last modified date of the item.
Name | Gets or sets the name of the item.
Password | Gets or sets the password for data encryption/decryption of the item.
Path | Gets or sets the directory location of the item.
Size | The uncompressed data size of the item.
Tag | Gets or sets an object reference that can be used to associate this instance with any other.
VolumeNumber | The start volume number of this item.

Public Instance Methods

BeginUnzip | Overloaded. Begins an asynchronous unzip operation.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.
Unzip | Overloaded. Decompresses the item.

See Also

ArchiveItem Class | Dart.PowerTCP.Zip Namespace


ArchiveItem Constructor

Creates an individual item inside an Archive.

Overload List

Creates an individual item inside an Archive.

public ArchiveItem(string);

Creates an individual item inside an Archive.

public ArchiveItem(Stream);

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem Constructor (String)

Creates an individual item inside an Archive.

[Visual Basic]
Overloads Public Sub New( _
   ByVal fileName As String _
)
[C#]
public ArchiveItem(
   string fileName
);

Parameters

fileName
The name of the file to be created as an ArchiveItem object.

Remarks

This class enables an application to access and manipulate the data of an individual file within an archive. It also provides support for data decompression at the file level.

To add the ArchiveItem to the Archive collection, use Add or Insert.

Changing any ArchiveItem property will not impact the source. Changes only have impact on the destination. For example, changing Name will not change the name of the original source file, but after a zip operation the file will be archived with the name specified in the Name property.

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'zip the data
Archive1.Zip("c:\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace | ArchiveItem Constructor Overload List


ArchiveItem Constructor (Stream)

Creates an individual item inside an Archive.

[Visual Basic]
Overloads Public Sub New( _
   ByVal source As Stream _
)
[C#]
public ArchiveItem(
   Stream source
);

Parameters

source
The Stream to be created as an ArchiveItem object.

Remarks

This class enables an application to access and manipulate the data of an individual file within an archive. It also provides support for data decompression at the file level.

To add the ArchiveItem to the Archive collection, use Add or Insert.

Changing any ArchiveItem property will not impact the source. Changes only have impact on the destination. For example, changing Name will not change the name of the original source file, but after a zip operation the file will be archived with the name specified in the Name property.

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'zip the data
Archive1.Zip("c:\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace | ArchiveItem Constructor Overload List


ArchiveItem Properties

The properties of the ArchiveItem class are listed below. For a complete list of ArchiveItem class members, see the ArchiveItem Members topic.

Public Instance Properties

Attributes | Gets or sets the file attributes for the ArchiveItem object.
Comment | Gets or sets the comment associated with the item.
CompressedSize | The compressed size of the item.
CompressionMethod | Gets or sets the compression algorithm used for data compression on this item.
CompressionRatio | The compression percentage of the item
CRC | The check-sum value for the item.
Encryption | Gets or sets the encryption algorithm type applied to this item.
LastModified | Gets a DateTime object representing the last modified date of the item.
Name | Gets or sets the name of the item.
Password | Gets or sets the password for data encryption/decryption of the item.
Path | Gets or sets the directory location of the item.
Size | The uncompressed data size of the item.
Tag | Gets or sets an object reference that can be used to associate this instance with any other.
VolumeNumber | The start volume number of this item.

See Also

ArchiveItem Class | Dart.PowerTCP.Zip Namespace


ArchiveItem.Attributes Property

Gets or sets the file attributes for the ArchiveItem object.

[Visual Basic]
Public Property Attributes As FileAttributes
[C#]
public System.IO.FileAttributes Attributes {get; set;}

Property Value

The FileAttributes of the ArchiveItem object.

Remarks

If the ArchiveItem represents a stream, this property returns a 0.

The following FileAttributes are supported by the Attributes property:

  • FileAttributes.Archive
  • FileAttributes.ReadOnly
  • FileAttributes.System
  • FileAttributes.Directory
  • FileAttributes.Hidden

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.Comment Property

Gets or sets the comment associated with the item.

[Visual Basic]
Public Property Comment As String
[C#]
public string Comment {get; set;}

Property Value

A string representing the comment for the ArchiveItem object.

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'zip the data
Archive1.Zip("c:\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.CompressedSize Property

The compressed size of the item.

[Visual Basic]
Public ReadOnly Property CompressedSize As Long
[C#]
public long CompressedSize {get;}

Property Value

A long representing the compressed size of the item.

Remarks

If the item is not compressed, this property will return 0.

To get the uncompressed size of the data, use Size.

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.CompressionMethod Property

Gets or sets the compression algorithm used for data compression on this item.

[Visual Basic]
Public Property CompressionMethod As CompressionMethod
[C#]
public CompressionMethod CompressionMethod {get; set;}

Property Value

CompressionMethod value specifying the method used for data compression. The default value is Deflate.

Remarks

During a collection level compression operation, if ArchiveItem.CompressionMethod is set, the value of DefaultCompressionMethod is ignored when compressing that item. If ArchiveItem.CompressionMethod is not set, the value of DefaultCompressionMethod is used during a compression operation.

Setting Store will archive the data to a zip file without performing any compression.

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.CompressionRatio Property

The compression percentage of the item

[Visual Basic]
Public ReadOnly Property CompressionRatio As Integer
[C#]
public int CompressionRatio {get;}

Property Value

An integer representing the compression percentage of the item

Remarks

If the item is not compressed, this property will return 0.

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.CRC Property

The check-sum value for the item.

[Visual Basic]
Public ReadOnly Property CRC As Long
[C#]
public long CRC {get;}

Property Value

A long representing the check-sum value for the item.

Remarks

The CRC property is obtained by performing a mathematical calculation on a block of data and returning a number that represents the content and organization of that data. This value is only available if the item has been compressed.

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.Encryption Property

Gets or sets the encryption algorithm type applied to this item.

[Visual Basic]
Public Property Encryption As Encryption
[C#]
public Encryption Encryption {get; set;}

Property Value

An Encryption type specifying the encryption algorithm applied to the item. The default value is Encryption.NoEncryption.

Remarks

An application should check this property to verify if a password is required to unzip this archive.

When creating an archive, this property can be used to apply an encryption type to a single item. To apply an encryption type to all items in the archive, use the Archive.Encryption property of the Archive object.

When an archive is opened, the Encryption property reflects what was opened. When an item is added using Add this property defaults to the value of DefaultEncryption.

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'zip the data
Archive1.Zip("c:\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.LastModified Property

Gets a DateTime object representing the last modified date of the item.

[Visual Basic]
Public ReadOnly Property LastModified As Date
[C#]
public System.DateTime LastModified {get;}

Property Value

A DateTime object representing the last modified date of the item.

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.Name Property

Gets or sets the name of the item.

[Visual Basic]
Public Property Name As String
[C#]
public string Name {get; set;}

Property Value

A string representing the name of the item.

Remarks

When creating an archive, this property will reflect the actual name of the file on the disk. If the item is a non-file (for example, a MemoryStream) this property will return "Streamn", where n is the index of the item in the archive. In this case, it is often useful to set this property to assign a new name to the item.

Changing this property will have no impact on the source, just the destination.

Example

[Visual Basic, C#] The following example demonstrates using the Progress event.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

Private Sub Archive1_Progress(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.ProgressEventArgs) Handles Archive1.Progress
    Try
        'Set the progress bar and status when fires
        'prgItem is the progress bar for an individual item and prgTotal is for all the items.
        Select Case (e.Status)

            Case Status.Unzipping
                'Show item progress
                prgItem.Maximum = e.Item.Size
                prgItem.Value = e.processedItemBytes

                'Show total progress
                prgTotal.Maximum = e.TotalBytes
                prgTotal.Value = e.ProcessedTotalBytes

                Debug.WriteLine("Unzipping " + e.Item.Name)
            Case Status.EndUnzip
                prgTotal.Value = prgTotal.Maximum
        End Select
    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

private void archive1_Progress(object sender, Dart.PowerTCP.Zip.ProgressEventArgs e)
        {
            try
            {
                //Set the progress bar and status when fires
                //prgItem is the progress bar for an individual item and prgTotal is for all the items.
                switch (e.Status)
                {
                    case Status.Unzipping:
                        //Show item progress
                        prgItem.Maximum = (int)e.Item.Size;
                        prgItem.Value = (int)e.ProcessedItemBytes;

                        //Show total progress
                        prgTotal.Maximum = (int)e.TotalBytes;
                        prgTotal.Value = (int)e.ProcessedTotalBytes;

                        Debug.WriteLine("Unzipping " + e.Item.Name);
                        break;
                    case Status.EndUnzip:
                        prgTotal.Value = prgTotal.Maximum;
                        break;
                }
            }
            catch {}
        }

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.Password Property

Gets or sets the password for data encryption/decryption of the item.

[Visual Basic]
Public Property Password As String
[C#]
public string Password {get; set;}

Property Value

A string representing the password for the item.

Remarks

This property will take precedence over any value specified in Archive.Password

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

'zip the data
Archive1.Zip("c:\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.Path Property

Gets or sets the directory location of the item.

[Visual Basic]
Public Property Path As String
[C#]
public string Path {get; set;}

Property Value

A string representing the directory location of the item.

Remarks

Changing this property will have no impact on the source, just the destination.

Changing this property may be useful when choosing to unzip a compressed item to a directory that is different than the original source.

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.Size Property

The uncompressed data size of the item.

[Visual Basic]
Public Property Size As Long
[C#]
public long Size {get; set;}

Property Value

A long representing the uncompressed data size of the item.

Remarks

To get the compressed data size of the item, use CompressedSize.

Example

[Visual Basic, C#] The following example demonstrates using the Progress event.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

Private Sub Archive1_Progress(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.ProgressEventArgs) Handles Archive1.Progress
    Try
        'Set the progress bar and status when fires
        'prgItem is the progress bar for an individual item and prgTotal is for all the items.
        Select Case (e.Status)

            Case Status.Unzipping
                'Show item progress
                prgItem.Maximum = e.Item.Size
                prgItem.Value = e.processedItemBytes

                'Show total progress
                prgTotal.Maximum = e.TotalBytes
                prgTotal.Value = e.ProcessedTotalBytes

                Debug.WriteLine("Unzipping " + e.Item.Name)
            Case Status.EndUnzip
                prgTotal.Value = prgTotal.Maximum
        End Select
    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

private void archive1_Progress(object sender, Dart.PowerTCP.Zip.ProgressEventArgs e)
        {
            try
            {
                //Set the progress bar and status when fires
                //prgItem is the progress bar for an individual item and prgTotal is for all the items.
                switch (e.Status)
                {
                    case Status.Unzipping:
                        //Show item progress
                        prgItem.Maximum = (int)e.Item.Size;
                        prgItem.Value = (int)e.ProcessedItemBytes;

                        //Show total progress
                        prgTotal.Maximum = (int)e.TotalBytes;
                        prgTotal.Value = (int)e.ProcessedTotalBytes;

                        Debug.WriteLine("Unzipping " + e.Item.Name);
                        break;
                    case Status.EndUnzip:
                        prgTotal.Value = prgTotal.Maximum;
                        break;
                }
            }
            catch {}
        }

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.Tag Property

Gets or sets an object reference that can be used to associate this instance with any other.

[Visual Basic]
Public Property Tag As Object
[C#]
public object Tag {get; set;}

Property Value

Any object that is associated with the component; null if no objects are associated with the component. Any object that is associated with the object, null if no objects are associated with the object

Remarks

Use this property to associate any type derived from Object class with the component. A common use for the Tag property is to store data that is closely associated with the component.

Use this property to associate any object with the object.

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.VolumeNumber Property

The start volume number of this item.

[Visual Basic]
Public ReadOnly Property VolumeNumber As Integer
[C#]
public int VolumeNumber {get;}

Property Value

An integer specifying the start volume number.

Remarks

The start volume number that indicates where this item starts when spanned across multiple volumes.

Please note that VolumeNumber is 0 based and will return 0 when the ArchiveItem is not spanned.

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem Methods

The methods of the ArchiveItem class are listed below. For a complete list of ArchiveItem class members, see the ArchiveItem Members topic.

Public Instance Methods

BeginUnzip | Overloaded. Begins an asynchronous unzip operation.
Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.
Unzip | Overloaded. Decompresses the item.

See Also

ArchiveItem Class | Dart.PowerTCP.Zip Namespace


BeginUnzip Method

PowerTCP Zip Compression for .NET

ArchiveItem.BeginUnzip Method

Begins an asynchronous unzip operation.

Overload List

Begins an asynchronous unzip operation.

public IAsyncResult BeginUnzip(string,bool,Overwrite,object);

Begins an asynchronous unzip operation.

public IAsyncResult BeginUnzip(Stream,object);

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.BeginUnzip Method (Stream, Object)

Begins an asynchronous unzip operation.

[Visual Basic]
Overloads Public Function BeginUnzip( _
   ByVal destination As Stream, _
   ByVal state As Object _
) As IAsyncResult
[C#]
public IAsyncResult BeginUnzip(
   Stream destination,
   object state
);

Parameters

destination
The destination stream for the decompressed data.
state
User state information.

Return Value

An IAsyncResult that identifies the asynchronous operation.

Remarks

An unzip operation on an ArchiveItem object will only decompress the item and not any other items in the collection.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace | ArchiveItem.BeginUnzip Overload List


ArchiveItem.BeginUnzip Method (String, Boolean, Overwrite, Object)

Begins an asynchronous unzip operation.

[Visual Basic]
Overloads Public Function BeginUnzip( _
   ByVal destination As String, _
   ByVal preservePath As Boolean, _
   ByVal overwrite As Overwrite, _
   ByVal state As Object _
) As IAsyncResult
[C#]
public IAsyncResult BeginUnzip(
   string destination,
   bool preservePath,
   Overwrite overwrite,
   object state
);

Parameters

destination
The destination directory for storing decompressed files.
preservePath
true if the directory path of the compressed item is preserved; false otherwise
overwrite
Specifies whether to overwrite any existing files.
state
User state information.

Return Value

An IAsyncResult that identifies the asynchronous operation.

Remarks

An unzip operation on an ArchiveItem object will only decompress the item and not any other items in the collection.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace | ArchiveItem.BeginUnzip Overload List


Unzip Method

PowerTCP Zip Compression for .NET

ArchiveItem.Unzip Method

Decompresses the item.

Overload List

Decompresses the item.

public void Unzip(string,bool,Overwrite);

Decompresses the item.

public void Unzip(Stream);

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace


ArchiveItem.Unzip Method (Stream)

Decompresses the item.

[Visual Basic]
Overloads Public Sub Unzip( _
   ByVal destination As Stream _
)
[C#]
public void Unzip(
   Stream destination
);

Remarks

An unzip operation on an ArchiveItem will only decompress the item and not any other items in the collection.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates unzipping from an individual ArchiveItem.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

If (Archive1.Count > 1) Then

    'Unzip the first item in the collection to a file, preserving its path
    Archive1(0).Unzip("c:\Test", True, Overwrite.Always)

    'Unzip the second item in the collection to a memory stream
    Dim stream = New System.IO.MemoryStream()
    Archive1(1).Unzip(stream)
End If

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

if (archive1.Count > 1)
{
    //Unzip the first item in the collection to a file, preserving its path
    archive1[0].Unzip("c:\\Test", true, Overwrite.Always);

    //Unzip the second item in the collection to a memory stream
    System.IO.MemoryStream stream = new System.IO.MemoryStream();
    archive1[1].Unzip(stream);
}

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace | ArchiveItem.Unzip Overload List


ArchiveItem.Unzip Method (String, Boolean, Overwrite)

Decompresses the item.

[Visual Basic]
Overloads Public Sub Unzip( _
   ByVal destination As String, _
   ByVal preservePath As Boolean, _
   ByVal overwrite As Overwrite _
)
[C#]
public void Unzip(
   string destination,
   bool preservePath,
   Overwrite overwrite
);

Parameters

destination
The destination directory for storing the decompressed file.
preservePath
true if the directory path of the compressed item is preserved; false otherwise
overwrite
Specifies whether to overwrite an existing file.

Remarks

An unzip operation on an ArchiveItem will only decompress the item and not any other items in the collection.

Exceptions

Exception Type | Condition
ZipException | A critical zip operation error occurred during this activity. Please see ZipException.Message for details.

Example

[Visual Basic, C#] The following example demonstrates unzipping from an individual ArchiveItem.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

If (Archive1.Count > 1) Then

    'Unzip the first item in the collection to a file, preserving its path
    Archive1(0).Unzip("c:\Test", True, Overwrite.Always)

    'Unzip the second item in the collection to a memory stream
    Dim stream = New System.IO.MemoryStream()
    Archive1(1).Unzip(stream)
End If

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

if (archive1.Count > 1)
{
    //Unzip the first item in the collection to a file, preserving its path
    archive1[0].Unzip("c:\\Test", true, Overwrite.Always);

    //Unzip the second item in the collection to a memory stream
    System.IO.MemoryStream stream = new System.IO.MemoryStream();
    archive1[1].Unzip(stream);
}

See Also

ArchiveItem Class | ArchiveItem Members | Dart.PowerTCP.Zip Namespace | ArchiveItem.Unzip Overload List


BusyException Class

Thrown whenever a method is called to perform an operation when an operation is already in progress.

For a list of all members of this type, see BusyException Members.

System.Object
Exception
ApplicationException
BusyException

[Visual Basic]
Public Class BusyException
Inherits ApplicationException
[C#]
public class BusyException : ApplicationException

Remarks

This exception is thrown if a method is called to perform an upper-layer protocol operation when an operation is already in progress. To keep this exception from being thrown, check the object.Busy property to see if an operation is already in progress.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

BusyException Members | Dart.PowerTCP.Zip Namespace


BusyException Members

Public Instance Constructors

BusyException Overloaded. Initialize a new instance of the BusyException class.

Public Instance Properties

HelpLink (inherited from Exception) | Gets or sets a link to the help file associated with this exception.
InnerException (inherited from Exception) | Gets the Exception instance that caused the current exception.
Message (inherited from Exception) | Gets a message that describes the current exception.
Source (inherited from Exception) | Gets or sets the name of the application or the object that causes the error.
StackTrace (inherited from Exception) | Gets a string representation of the frames on the call stack at the time the current exception was thrown.
TargetSite (inherited from Exception) | Gets the method that throws the current exception.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetBaseException (inherited from Exception) | When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetObjectData (inherited from Exception) | When overridden in a derived class, sets the SerializationInfo with information about the exception.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Exception) | Creates and returns a string representation of the current exception.

See Also

BusyException Class | Dart.PowerTCP.Zip Namespace


BusyException Constructor

Initializes a new instance of the BusyException class.

Overload List

Initializes a new instance of the BusyException class.

public BusyException();

Initializes a new instance of the BusyException class.

public BusyException(string);

Initializes a new instance of the BusyException class.

public BusyException(string,Exception);

See Also

BusyException Class | BusyException Members | Dart.PowerTCP.Zip Namespace


BusyException Constructor ()

Initializes a new instance of the BusyException class.

[Visual Basic]
Overloads Public Sub New()
[C#]
public BusyException();

See Also

BusyException Class | BusyException Members | Dart.PowerTCP.Zip Namespace | BusyException Constructor Overload List


BusyException Constructor (String)

Initializes a new instance of the BusyException class.

[Visual Basic]
Overloads Public Sub New( _
   ByVal message As String _
)
[C#]
public BusyException(
   string message
);

See Also

BusyException Class | BusyException Members | Dart.PowerTCP.Zip Namespace | BusyException Constructor Overload List


BusyException Constructor (String, Exception)

Initializes a new instance of the BusyException class.

[Visual Basic]
Overloads Public Sub New( _
   ByVal message As String, _
   ByVal e As Exception _
)
[C#]
public BusyException(
   string message,
   Exception e
);

See Also

BusyException Class | BusyException Members | Dart.PowerTCP.Zip Namespace | BusyException Constructor Overload List


CompressionLevel Enumeration

Enumerates the compression levels.

[Visual Basic]
Public Enum CompressionLevel
[C#]
public enum CompressionLevel

Remarks

For no compression, use Store.

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

Members

Member Name | Description
Low | This will achieve the lowest compression with the fastest speed.
Medium | This will achieve moderate compression with moderate speed.
High | This will achieve the highest compression with the slowest speed.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


CompressionMethod Enumeration

Enumerates the different compression types

[Visual Basic]
Public Enum CompressionMethod
[C#]
public enum CompressionMethod

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

Members

Member Name | Description
Store | No compression is applied to the data.
Deflate | The zip compression algorithm based on RFC 1951.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


DiskEventArgs Class

Provides status information when removable media is used

For a list of all members of this type, see DiskEventArgs Members.

System.Object
EventArgs
DiskEventArgs

[Visual Basic]
Public Class DiskEventArgs
Inherits EventArgs
[C#]
public class DiskEventArgs : EventArgs

Remarks

An instance of the DiskEventArgs type is a parameter of the Disk event, encapsulating disk specific information.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

DiskEventArgs Members | Dart.PowerTCP.Zip Namespace


DiskEventArgs Members

Public Instance Constructors

DiskEventArgs Constructor An instance of the DiskEventArgs

Public Instance Properties

DiskNumber | The disk number needed during a spanning operation
Exception | The exception information when a spanning operation has a problem with a disk.
IgnoreLabel | Gets or sets whether to ignore volume label information when using removable media.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

See Also

DiskEventArgs Class | Dart.PowerTCP.Zip Namespace


DiskEventArgs Constructor

An instance of the DiskEventArgs

[Visual Basic]
Public Sub New( _
   ByVal diskNumber As Integer, _
   ByVal exception As ZipException, _
   ByVal ignoreLabel As Boolean _
)
[C#]
public DiskEventArgs(
   int diskNumber,
   ZipException exception,
   bool ignoreLabel
);

See Also

DiskEventArgs Class | DiskEventArgs Members | Dart.PowerTCP.Zip Namespace


DiskEventArgs Properties

The properties of the DiskEventArgs class are listed below. For a complete list of DiskEventArgs class members, see the DiskEventArgs Members topic.

Public Instance Properties

DiskNumber | The disk number needed during a spanning operation
Exception | The exception information when a spanning operation has a problem with a disk.
IgnoreLabel | Gets or sets whether to ignore volume label information when using removable media.

See Also

DiskEventArgs Class | Dart.PowerTCP.Zip Namespace


DiskEventArgs.DiskNumber Property

The disk number needed during a spanning operation

[Visual Basic]
Public ReadOnly Property DiskNumber As Integer
[C#]
public int DiskNumber {get;}

Remarks

This value will represent the disk required during a spanning operation. If a disk does not match the specifications in SpanConfiguration, the Disk event will fire again with the same DiskNumber value and the Exception will contain the Exception.

An integer representing the disk required.

See Also

DiskEventArgs Class | DiskEventArgs Members | Dart.PowerTCP.Zip Namespace


DiskEventArgs.Exception Property

The exception information when a spanning operation has a problem with a disk.

[Visual Basic]
Public ReadOnly Property Exception As ZipException
[C#]
public ZipException Exception {get;}

Property Value

A ZipException representing the spanning exception.

Remarks

Checking the value of Exception is recommended for all spanning operations. If IgnoreLabel is used, the Exception property will contain a ZipException with an error code of RemovableMediaHasIncorrectLabel.

If an invalid part size has been specified or the current disk does not have enough space, an Exception with an error code of NotEnoughSpaceForSpan will be set.

See Also

DiskEventArgs Class | DiskEventArgs Members | Dart.PowerTCP.Zip Namespace


DiskEventArgs.IgnoreLabel Property

Gets or sets whether to ignore volume label information when using removable media.

[Visual Basic]
Public Property IgnoreLabel As Boolean
[C#]
public bool IgnoreLabel {get; set;}

Property Value

A ZipException representing the spanning exception.

Remarks

Checking the value of Exception is recommended for all spanning operations. If IgnoreLabel is used, the Exception property will contain a ZipException with an error code of RemovableMediaHasIncorrectLabel.

Not all zip compression products use volume labels when creating spanned archives. This property should be used when attempting to read such an archive. Please note that if IgnoreLabel is true, the Archive component will attempt to read the disk even if the data is not valid. Once encountering invalid data, the remainder of the disk will be skipped and you will be prompted for the next disk.

See Also

DiskEventArgs Class | DiskEventArgs Members | Dart.PowerTCP.Zip Namespace


DiskEventHandler Delegate

The delegate for the Disk event.

[Visual Basic]
Public Delegate Sub DiskEventHandler( _
   ByVal sender As Object, _
   ByVal e As DiskEventArgs _
)
[C#]
public delegate void DiskEventHandler(
   object sender,
   DiskEventArgs e
);

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


Encryption Enumeration

Enumerates the type of encryption to use or in use

[Visual Basic]
Public Enum Encryption
[C#]
public enum Encryption

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

Members

Member Name | Description
None | No encryption applied to the data.
Standard | Standard zip encryption.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


EndEventArgs Class

Abstract base class for all event argument objects that mark the completion of an asynchronous method.

For a list of all members of this type, see EndEventArgs Members.

System.Object
EventArgs
EndEventArgs

[Visual Basic]
Public Class EndEventArgs
Inherits EventArgs
[C#]
public class EndEventArgs : EventArgs

Remarks

All PowerTCP EventArgs classes derive from this class, providing these classes with an Exception and State property. The Exception property returns any Exception which occurred during the asynchronous operation. The EndEventArgs.Stats property returns any object passed in to the accompanying BeginXXX method.

Example

[Visual Basic, C#] The following example demonstrates loading a compressed file and asynchronously unzipping the contents.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Open a compressed stream.  This populates the Archive collection.
Archive1.Open("c:\test.zip")

'Preserve the path structure and overwrite any existing files.
Archive1.PreservePath = True
Archive1.Overwrite = Overwrite.Always

'Begin an asynchronous unzip process
Archive1.BeginUnzip("c:\test", Nothing)

Private Sub Archive1_EndUnzip(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.EndEventArgs) Handles Archive1.EndUnzip
    Try
        'Check for any zip operation exceptions
        If e.Exception Is Nothing Then
            MessageBox.Show("Extraction Complete!")
        Else
            MessageBox.Show(e.Exception.Message)
        End If

    Catch

    End Try
End Sub
[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Open a compressed stream.  This populates the Archive collection.
archive1.Open("c:\\test.zip");

//Preserve the path structure and overwrite any existing files.
archive1.PreservePath = true;
archive1.Overwrite = Overwrite.Always;

//Begin an asynchronous unzip process
archive1.BeginUnzip("c:\\test",null);

private void archive1_EndUnzip(object sender, Dart.PowerTCP.Zip.EndEventArgs e)
{
    try
    {
        if (e.Exception == null)
            MessageBox.Show("Extraction Complete!");
        else
            MessageBox.Show(e.Exception.Message);
    }
    catch {}

}

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

EndEventArgs Members | Dart.PowerTCP.Zip Namespace


EndEventArgs Members

Public Instance Constructors

EndEventArgs Constructor An instance of the EndEventArgs

Public Instance Properties

Exception | Gets the Exception that occurred.
State | Returns any state information included with this event.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

See Also

EndEventArgs Class | Dart.PowerTCP.Zip Namespace


EndEventArgs Constructor

An instance of the EndEventArgs

[Visual Basic]
Public Sub New( _
   ByVal exception As ZipException, _
   ByVal state As Object _
)
[C#]
public EndEventArgs(
   ZipException exception,
   object state
);

See Also

EndEventArgs Class | EndEventArgs Members | Dart.PowerTCP.Zip Namespace


EndEventArgs Properties

The properties of the EndEventArgs class are listed below. For a complete list of EndEventArgs class members, see the EndEventArgs Members topic.

Public Instance Properties

Exception | Gets the Exception that occurred.
State | Returns any state information included with this event.

See Also

EndEventArgs Class | Dart.PowerTCP.Zip Namespace


EndEventArgs.Exception Property

Gets the Exception that occurred.

[Visual Basic]
Public ReadOnly Property Exception As ZipException
[C#]
public ZipException Exception {get;}

Property Value

The Exception that occurred.

See Also

EndEventArgs Class | EndEventArgs Members | Dart.PowerTCP.Zip Namespace


EndEventArgs.State Property

Returns any state information included with this event.

[Visual Basic]
Public ReadOnly Property State As Object
[C#]
public object State {get;}

Property Value

An Object representing state.

See Also

EndEventArgs Class | EndEventArgs Members | Dart.PowerTCP.Zip Namespace


EndEventHandler Delegate

The delegate for the completion events.

[Visual Basic]
Public Delegate Sub EndEventHandler( _
   ByVal sender As Object, _
   ByVal e As EndEventArgs _
)
[C#]
public delegate void EndEventHandler(
   object sender,
   EndEventArgs e
);

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


ErrorCode Enumeration

Enumerates the error codes.

[Visual Basic]
Public Enum ErrorCode
[C#]
public enum ErrorCode

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

Members

Member Name | Description
Abort | The Archive component has aborted the current operation. This is a result of the Archive.Abort method called in the code.
SourceEmpty | Either no source is specified or the specified source is empty. For an Unzip operation, a source zip archive has to be opened first.
DestinationEmpty | The destination parameter is empty.
CollectionEmpty | The collection is empty.
FileOpen | The file is open.
FileExists | The destination file exists. Use Overwrite property if you would like to overwrite it.
NotEnoughSpaceForSpan | The removable media does not have enough available space according to the Span Configuration.
WriteError | A write error has occurred.
ReadError | A read error has occurred.
FileNotFound | The specified file was not found.
InvalidMedia | The specified media is invalid.
ImproperZipFile | The specified zip archive is invalid.
ImproperOperation | Improper operation, refer to the Help Documentation for more information.
ImproperSpanSize | The specified PartSize for spanning is invalid.
PasswordRequired | A password is required for unzipping this archive/item because it is encrypted.
UnknownAlgorithm | The encryption algorithm is not supported by Dart Archive component.
InvalidPassword | The given password is invalid.
DriveNotRemovable | Spanning error: The drive is not removable.
InvalidDirectory | The specified directory is invalid.
NotSupported | The selected feature is not supported by the current version.
UnsupportedFormat | The source archive is in the format that the current version does not support.
NotImplemented | The selection is not implemented in the current version.
HuffmanTreeHeightError | Deflate error: Huffman tree height exceeds the maximum.
WriteBitsTooLong | Deflate error: write bit length exceeds the maximum.
LengthCode16Error | Deflate decompression error: error in length code 16.
InvalidLengthCode | Deflate decompression error: an invalid length code was found.
LendthCodeError | Deflate decompression error: the number of a length code i should be less than of equal to pow(2, i).
LiteralCodeCountOutOfRange | Deflate decompression error: the literal code count is out of range.
DistanceCodeCountOutOfRange | Deflate decompression error: the distance code count is out of range.
LengthCodeCountOutOfRange | Deflate decompression error: the length code count is out of range.
LiteralLengthCodeOutOfRange | Deflate decompression error: the literal/length code is out of range.
DistanceCodeOutOfRange | Deflate decompression error: the distance code is out of range.
LengthExceedMaximum | Deflate decompression error: the length exceeds the maximum.
DistanceExceedMaximum | Deflate decompression error: the distance exceeds the maximum.
DistanceError | Deflate decompression error: an error was found in distance codes.
NoCompressionError | Deflate decompression error: a data block is marked as no compression but it is not.
UnknownBlockType | Deflate decompression error: an invalid data block type was found.
InputBitLengthError | Deflate decompression error: an error was found with input bit lengths when building the code tree
BuildCodeTreeError | Deflate decompression error: an error occurred while building the code tree.
CRCMismatch | Deflate decompression error: the CRC check failed.
SizeMismatch | Deflate decompression error: the decompressed data size does not match the uncompressed data size.
ItemIndexOutOfRange | The item index is out of range.
DestStreamNotAllowedForZipWSpan | Spanning error: when spanning or splitting, the destination is not allowed to be a stream.
AddRemoveOpNotAllowed | Spanning error: addition or deletion operations are not allowed on spanned or split archives.
PropertyValueOutOfRange | Property value out of range. refer to the Help documentation for more information.
FileWOpenError | File could not be opened for writing.
FileOpenError | File open failed.
TempFileCreationError | The temporary file creation failed.
InvalidFileName | The specified name contains invalid characters.
TempFileNameError | (DEBUG error code)Some difficulty in making up the temp file name.
FileCreationFailed | File creation failed.
CompressionMethodNotSupported | The compression method is not supported.
SpanArchiveLimitation | Spanned archive limitation: Add, Remove, or Zip operations can not be applied to a spanned archive.
DestinationNotWritable | The destination of a Zip operation must be writable.
TempFileOperationFailure | Operations on the temp file failed. Either the temp file has been destroyed or moved.
SourceArchiveNotReadable | The source archive is not readable. If you pass a memory stream archive, closing the stream may cause this problem.
ArchiveItemInvalidCast | ArchiveItem instance expected for this operation.
StreamCopyFailed | Stream copy failed, either the source can't be read or the destination can't be written to.
CDEndRecordNotFound | The central directory end record cannot be found. Either it is not a standard zip format, or if you are trying to open a spanned zip archive on removable media. Please insert the last volume.
CDSignatureNotFound | The central directory signature was not found. This zip archive has been corrupted.
LocalHeaderSignatureNotFound | The local header signature was not found. This zip archive might have been corrupted.
EncryptionNotSpecified | You have set up a password. You need to set up the encryption method as well.
ItemNameEmpty | Either the specified name is empty or it contains invalid characters.
PasswordEmpty | The specified encryption was not applied to the item because the password is empty.
EncryptionSkipped | The specified encryption was not applied to the item because the item is encrypted already. Unzip it first and then re-zip it if you really would like to change the encryption method or use a different password.
InternalError | An internal error has occurred. Call Dart customer service for support.
AccessRemovableMediaFailed | Failed to access available space information on the removable media.
NotEnoughSpaceForCDEndRecord | The removable media does not have enough space for storing the Central Directory End Record. You might have something on the volume.
FileNotFoundForSelfExtraction | The file 'DartAttach.bin' is needed for self extraction. It needs to be in the System32 directory.
CompressionMethodNotApplied | The specified compression method was not applied because the item is already compressed.
RemovableMediaHasIncorrectLabel | The removable media has a label different from expected. Set the IgnoreLabel to true if you want to use the removable media anyway.
UnzipError | An error has occurred during the unzip operation.
DirectoryNotAccessible | The directory is not accessible so the files under the directory are not added to the collection.
ExcludeDirectoryNotAccessible | The directory is not accessible so the files under the directory are not added to the collection.
GzipFormatCompressionNotSupported | This release does not support gZip compression. Therefore, Add, Insert, Remove or Zip operations are not allowed to apply to a gZip archive.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


ExceptionEventArgs Class

Arguments for the Exception event.

For a list of all members of this type, see ExceptionEventArgs Members.

System.Object
EventArgs
ExceptionEventArgs

[Visual Basic]
Public Class ExceptionEventArgs
Inherits EventArgs
[C#]
public class ExceptionEventArgs : EventArgs

Example

[Visual Basic, C#] The following example demonstrates using QuickZip and specifying specific options. Only QuickZip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path structure of the files
Archive1.PreservePath = True

'Include any subdirectories
Archive1.IncludeSubs = True

'Specify compression level
Archive1.CompressionLevel = CompressionLevel.Medium

'Use the Deflate compression method
Archive1.DefaultCompressionMethod = CompressionMethod.Deflate

'Exclude any text files
Archive1.ExcludePattern = "*.txt"

'Set to use encryption
Archive1.DefaultEncryption = Encryption.Standard

'Specify the password
Archive1.Password = "testme"

'Perform the compression operation - this is the only required method for the operation
Archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path structure of the files
archive1.PreservePath = true;

//Include any subdirectories
archive1.IncludeSubs = true;

//Specify compression level
archive1.CompressionLevel = CompressionLevel.Medium;

//Use the Deflate compression method
archive1.DefaultCompressionMethod = CompressionMethod.Deflate;

//Exclude any text files
archive1.ExcludePattern = "*.txt";

//Set to use encryption

archive1.DefaultEncryption = Encryption.Standard;

//Specify the password
archive1.Password = "testme";

//Perform the compression operation - this is the only required method for the operation
archive1.QuickZip("c:\\Test\\*.*", "c:\\test.zip");

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

ExceptionEventArgs Members | Dart.PowerTCP.Zip Namespace


ExceptionEventArgs Members

Public Instance Constructors

ExceptionEventArgs Constructor An instance of the ExceptionEventArgs

Public Instance Properties

Exception | The exception condition that occurred during the processing of an item in the collection.
Index | The index of the ArchiveItem object in the Archive object that the exception condition occurs.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

See Also

ExceptionEventArgs Class | Dart.PowerTCP.Zip Namespace


ExceptionEventArgs Constructor

An instance of the ExceptionEventArgs

[Visual Basic]
Public Sub New( _
   ByVal index As Integer, _
   ByVal exception As ZipException _
)
[C#]
public ExceptionEventArgs(
   int index,
   ZipException exception
);

See Also

ExceptionEventArgs Class | ExceptionEventArgs Members | Dart.PowerTCP.Zip Namespace


ExceptionEventArgs Properties

The properties of the ExceptionEventArgs class are listed below. For a complete list of ExceptionEventArgs class members, see the ExceptionEventArgs Members topic.

Public Instance Properties

Exception | The exception condition that occurred during the processing of an item in the collection.
Index | The index of the ArchiveItem object in the Archive object that the exception condition occurs.

See Also

ExceptionEventArgs Class | Dart.PowerTCP.Zip Namespace


ExceptionEventArgs.Exception Property

The exception condition that occurred during the processing of an item in the collection.

[Visual Basic]
Public ReadOnly Property Exception As ZipException
[C#]
public ZipException Exception {get;}

Property Value

A ZipException object representing the exception.

See Also

ExceptionEventArgs Class | ExceptionEventArgs Members | Dart.PowerTCP.Zip Namespace


ExceptionEventArgs.Index Property

The index of the ArchiveItem object in the Archive object that the exception condition occurs.

[Visual Basic]
Public ReadOnly Property Index As Integer
[C#]
public int Index {get;}

Property Value

An integer that is an index in the Archive collection.

See Also

ExceptionEventArgs Class | ExceptionEventArgs Members | Dart.PowerTCP.Zip Namespace


ExceptionEventHandler Delegate

The delegate for the Exception event.

[Visual Basic]
Public Delegate Sub ExceptionEventHandler( _
   ByVal sender As Object, _
   ByVal e As ExceptionEventArgs _
)
[C#]
public delegate void ExceptionEventHandler(
   object sender,
   ExceptionEventArgs e
);

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


Format Enumeration

Enumerates the compression format the Archive component currently supports.

[Visual Basic]
Public Enum Format
[C#]
public enum Format

Members

Member Name | Description
Zip | The compression format conforms to the ZIP standard as used by PKZIP and WINZIP.
Gzip | The compression format conforms to the gZip standard.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


Overwrite Enumeration

Enumerates values which determine how files are overwritten.

[Visual Basic]
Public Enum Overwrite
[C#]
public enum Overwrite

Remarks

This enumeration is used by the "unzip"-related Archive methods to specify under what conditions files with conflicting file names should be overwritten.

Example

[Visual Basic, C#] The following example demonstrates using QuickUnzip and specifying specific options. Only QuickUnzip is required in this operation.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Preserve the path when unzipping
Archive1.PreservePath = True

'Overwrite any existing files
Archive1.Overwrite = Overwrite.Always

'Unzip all the files to c:\test
Archive1.QuickUnzip("c:\test.zip", "c:\Test")

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Preserve the path when unzipping
archive1.PreservePath = true;

//Overwrite any existing files
archive1.Overwrite = Overwrite.Always;

//Unzip all the files to c:\test
archive1.QuickUnzip("c:\\test.zip", "c:\\Test");

Members

Member Name | Description
Never | Do not overwrite any files.
Always | Overwrite all files.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


ProgressEventArgs Class

The status of the current on-going operation

For a list of all members of this type, see ProgressEventArgs Members.

System.Object
EventArgs
ProgressEventArgs

[Visual Basic]
Public Class ProgressEventArgs
Inherits EventArgs
[C#]
public class ProgressEventArgs : EventArgs

Example

[Visual Basic, C#] The following example demonstrates using the Progress event.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

Private Sub Archive1_Progress(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.ProgressEventArgs) Handles Archive1.Progress
    Try
        'Set the progress bar and status when fires
        'prgItem is the progress bar for an individual item and prgTotal is for all the items.
        Select Case (e.Status)

            Case Status.Unzipping
                'Show item progress
                prgItem.Maximum = e.Item.Size
                prgItem.Value = e.processedItemBytes

                'Show total progress
                prgTotal.Maximum = e.TotalBytes
                prgTotal.Value = e.ProcessedTotalBytes

                Debug.WriteLine("Unzipping " + e.Item.Name)
            Case Status.EndUnzip
                prgTotal.Value = prgTotal.Maximum
        End Select
    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

private void archive1_Progress(object sender, Dart.PowerTCP.Zip.ProgressEventArgs e)
        {
            try
            {
                //Set the progress bar and status when fires
                //prgItem is the progress bar for an individual item and prgTotal is for all the items.
                switch (e.Status)
                {
                    case Status.Unzipping:
                        //Show item progress
                        prgItem.Maximum = (int)e.Item.Size;
                        prgItem.Value = (int)e.ProcessedItemBytes;

                        //Show total progress
                        prgTotal.Maximum = (int)e.TotalBytes;
                        prgTotal.Value = (int)e.ProcessedTotalBytes;

                        Debug.WriteLine("Unzipping " + e.Item.Name);
                        break;
                    case Status.EndUnzip:
                        prgTotal.Value = prgTotal.Maximum;
                        break;
                }
            }
            catch {}
        }

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

ProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


ProgressEventArgs Members

Public Instance Constructors

ProgressEventArgs Constructor An instance of the ProgressEventArgs

Public Instance Properties

Item | The ArchiveItem object currently being processed.
ItemIndex | The index of the ArchiveItem object currently being processed.
ProcessedItemBytes | The total uncompressed bytes of the ArchiveItem being processed.
ProcessedTotalBytes | The cumulative number of bytes that have been processed in the Archive collection during the current operation.
Status | The status of the current on-going operation.
TotalBytes | The total bytes to be processed for this operation.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

See Also

ProgressEventArgs Class | Dart.PowerTCP.Zip Namespace


ProgressEventArgs Constructor

An instance of the ProgressEventArgs

[Visual Basic]
Public Sub New( _
   ByVal status As Status, _
   ByVal item As ArchiveItem, _
   ByVal index As Integer, _
   ByVal processedItemBytes As Long, _
   ByVal processedTotalBytes As Long, _
   ByVal totalBytes As Long _
)
[C#]
public ProgressEventArgs(
   Status status,
   ArchiveItem item,
   int index,
   long processedItemBytes,
   long processedTotalBytes,
   long totalBytes
);

See Also

ProgressEventArgs Class | ProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


ProgressEventArgs Properties

The properties of the ProgressEventArgs class are listed below. For a complete list of ProgressEventArgs class members, see the ProgressEventArgs Members topic.

Public Instance Properties

Item | The ArchiveItem object currently being processed.
ItemIndex | The index of the ArchiveItem object currently being processed.
ProcessedItemBytes | The total uncompressed bytes of the ArchiveItem being processed.
ProcessedTotalBytes | The cumulative number of bytes that have been processed in the Archive collection during the current operation.
Status | The status of the current on-going operation.
TotalBytes | The total bytes to be processed for this operation.

See Also

ProgressEventArgs Class | Dart.PowerTCP.Zip Namespace


ProgressEventArgs.Item Property

The ArchiveItem object currently being processed.

[Visual Basic]
Public ReadOnly Property Item As ArchiveItem
[C#]
public ArchiveItem Item {get;}

Property Value

An ArchiveItem representing the currently being processed.

See Also

ProgressEventArgs Class | ProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


ProgressEventArgs.ItemIndex Property

The index of the ArchiveItem object currently being processed.

[Visual Basic]
Public ReadOnly Property ItemIndex As Integer
[C#]
public int ItemIndex {get;}

Property Value

An integer representing the index of the item currently being processed.

See Also

ProgressEventArgs Class | ProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


ProgressEventArgs.ProcessedItemBytes Property

The total uncompressed bytes of the ArchiveItem being processed.

[Visual Basic]
Public ReadOnly Property ProcessedItemBytes As Long
[C#]
public long ProcessedItemBytes {get;}

Property Value

A long representing the total uncompressed bytes of the ArchiveItem being processed.

Remarks

To get the processed bytes of the collection, use ProcessedTotalBytes.

See Also

ProgressEventArgs Class | ProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


ProgressEventArgs.ProcessedTotalBytes Property

The cumulative number of bytes that have been processed in the Archive collection during the current operation.

[Visual Basic]
Public ReadOnly Property ProcessedTotalBytes As Long
[C#]
public long ProcessedTotalBytes {get;}

Property Value

A long representing the total bytes that have been processed in the Archive collection during the current operation.

Remarks

To get the total processed bytes of an individual ArchiveItem object, use ProcessedItemBytes.

See Also

ProgressEventArgs Class | ProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


ProgressEventArgs.Status Property

The status of the current on-going operation.

[Visual Basic]
Public ReadOnly Property Status As Status
[C#]
public Status Status {get;}

Property Value

Returns a Status enumeration representing the current state of the operation.

Remarks

For example, during a compression operation, Status will return, BeginZip, Zipping, and finally EndZip.

See Also

ProgressEventArgs Class | ProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


ProgressEventArgs.TotalBytes Property

The total bytes to be processed for this operation.

[Visual Basic]
Public ReadOnly Property TotalBytes As Long
[C#]
public long TotalBytes {get;}

Property Value

A long representing the total bytes to be processed for this operation.

Remarks

If the Progress Event is fired by an Archive level action, the TotalBytes is the uncompressed size of all the items in the Archive. If the Progress Event is fired by an ArchiveItem level action then the TotalSize is the uncompressed size of the ArchiveItem object.

See Also

ProgressEventArgs Class | ProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


ProgressEventHandler Delegate

The delegate for the Progress event.

[Visual Basic]
Public Delegate Sub ProgressEventHandler( _
   ByVal sender As Object, _
   ByVal e As ProgressEventArgs _
)
[C#]
public delegate void ProgressEventHandler(
   object sender,
   ProgressEventArgs e
);

Example

[Visual Basic, C#] The following example demonstrates using the Progress event.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

Private Sub Archive1_Progress(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.ProgressEventArgs) Handles Archive1.Progress
    Try
        'Set the progress bar and status when fires
        'prgItem is the progress bar for an individual item and prgTotal is for all the items.
        Select Case (e.Status)

            Case Status.Unzipping
                'Show item progress
                prgItem.Maximum = e.Item.Size
                prgItem.Value = e.processedItemBytes

                'Show total progress
                prgTotal.Maximum = e.TotalBytes
                prgTotal.Value = e.ProcessedTotalBytes

                Debug.WriteLine("Unzipping " + e.Item.Name)
            Case Status.EndUnzip
                prgTotal.Value = prgTotal.Maximum
        End Select
    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

private void archive1_Progress(object sender, Dart.PowerTCP.Zip.ProgressEventArgs e)
        {
            try
            {
                //Set the progress bar and status when fires
                //prgItem is the progress bar for an individual item and prgTotal is for all the items.
                switch (e.Status)
                {
                    case Status.Unzipping:
                        //Show item progress
                        prgItem.Maximum = (int)e.Item.Size;
                        prgItem.Value = (int)e.ProcessedItemBytes;

                        //Show total progress
                        prgTotal.Maximum = (int)e.TotalBytes;
                        prgTotal.Value = (int)e.ProcessedTotalBytes;

                        Debug.WriteLine("Unzipping " + e.Item.Name);
                        break;
                    case Status.EndUnzip:
                        prgTotal.Value = prgTotal.Maximum;
                        break;
                }
            }
            catch {}
        }

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


SelfExtractConfiguration Class

Used to configure how the items in a self extract zip archive will be extracted as files.

For a list of all members of this type, see SelfExtractConfiguration Members.

System.Object
SelfExtractConfiguration

[Visual Basic]
Public Class SelfExtractConfiguration
[C#]
public class SelfExtractConfiguration

Remarks

This class is designed to provide some flexibility to the application for configuring how the files in a zip archive will be self extracted.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

SelfExtractConfiguration Members | Dart.PowerTCP.Zip Namespace


SelfExtractConfiguration Members

Public Instance Constructors

SelfExtractConfiguration Constructor Creates an instance of the SelfExtractConfiguration class

Public Instance Properties

Caption | Gets or sets the caption of the extraction window.
EnableOverwrite | Gets or sets whether to give the end-user an Overwrite option.
EnablePath | Gets or sets whether to allow the end-user the option of specifying the destination directory.
Overwrite | Gets or sets whether to overwrite by default.
Path | Gets or sets the default destination folder for extraction.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

See Also

SelfExtractConfiguration Class | Dart.PowerTCP.Zip Namespace


SelfExtractConfiguration Constructor

Creates an instance of the SelfExtractConfiguration class

[Visual Basic]
Public Sub New( _
   ByVal caption As String, _
   ByVal path As String, _
   ByVal enablePath As Boolean, _
   ByVal overwrite As Overwrite, _
   ByVal enableOverwrite As Boolean _
)
[C#]
public SelfExtractConfiguration(
   string caption,
   string path,
   bool enablePath,
   Overwrite overwrite,
   bool enableOverwrite
);

See Also

SelfExtractConfiguration Class | SelfExtractConfiguration Members | Dart.PowerTCP.Zip Namespace


SelfExtractConfiguration Properties

The properties of the SelfExtractConfiguration class are listed below. For a complete list of SelfExtractConfiguration class members, see the SelfExtractConfiguration Members topic.

Public Instance Properties

Caption | Gets or sets the caption of the extraction window.
EnableOverwrite | Gets or sets whether to give the end-user an Overwrite option.
EnablePath | Gets or sets whether to allow the end-user the option of specifying the destination directory.
Overwrite | Gets or sets whether to overwrite by default.
Path | Gets or sets the default destination folder for extraction.

See Also

SelfExtractConfiguration Class | Dart.PowerTCP.Zip Namespace


SelfExtractConfiguration.Caption Property

Gets or sets the caption of the extraction window.

[Visual Basic]
Public Property Caption As String
[C#]
public string Caption {get; set;}

Property Value

A string that represents the caption of the self-extraction application window.

Remarks

By default, the value of the caption is "Zip Self Extracting..."

See Also

SelfExtractConfiguration Class | SelfExtractConfiguration Members | Dart.PowerTCP.Zip Namespace


SelfExtractConfiguration.EnableOverwrite Property

Gets or sets whether to give the end-user an Overwrite option.

[Visual Basic]
Public Property EnableOverwrite As Boolean
[C#]
public bool EnableOverwrite {get; set;}

Property Value

A boolean specifying whether to give the end-user an Overwrite option. The default value is false.

See Also

SelfExtractConfiguration Class | SelfExtractConfiguration Members | Dart.PowerTCP.Zip Namespace


SelfExtractConfiguration.EnablePath Property

Gets or sets whether to allow the end-user the option of specifying the destination directory.

[Visual Basic]
Public Property EnablePath As Boolean
[C#]
public bool EnablePath {get; set;}

Property Value

A boolean specifying whether to allow end-user the option of specifying the destination directory. The default value is false.

See Also

SelfExtractConfiguration Class | SelfExtractConfiguration Members | Dart.PowerTCP.Zip Namespace


SelfExtractConfiguration.Overwrite Property

Gets or sets whether to overwrite by default.

[Visual Basic]
Public Property Overwrite As Overwrite
[C#]
public Overwrite Overwrite {get; set;}

Property Value

A boolean indicating whether to overwrite any existing files during the unzip operation. Default value is false.

See Also

SelfExtractConfiguration Class | SelfExtractConfiguration Members | Dart.PowerTCP.Zip Namespace


SelfExtractConfiguration.Path Property

Gets or sets the default destination folder for extraction.

[Visual Basic]
Public Property Path As String
[C#]
public string Path {get; set;}

Property Value

A string value representing the destination folder. The default value is the system default temporary .

See Also

SelfExtractConfiguration Class | SelfExtractConfiguration Members | Dart.PowerTCP.Zip Namespace


SpanConfiguration Class

Used to configure how a multi-part zip archive is spanned over multiple disks or split on a hard drive.

For a list of all members of this type, see SpanConfiguration Members.

System.Object
SpanConfiguration

[Visual Basic]
Public Class SpanConfiguration
[C#]
public class SpanConfiguration

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

SpanConfiguration Members | Dart.PowerTCP.Zip Namespace


SpanConfiguration Members

Public Instance Constructors

SpanConfiguration Constructor Creates an instance of the SpanConfiguration class

Public Instance Properties

FirstPartSize | Gets or sets the size (in kilobytes) of the first part of a multi-part zip archive.
IsRemovableMedia | Gets or sets whether the target media is removable.
MinFreeSpace | Gets or sets the minimum free space on each removable media in kilobytes.
PartSize | Gets or sets the size (in kilobytes) of the target volume that holds one part of a multi-part zip archive.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

See Also

SpanConfiguration Class | Dart.PowerTCP.Zip Namespace


SpanConfiguration Constructor

Creates an instance of the SpanConfiguration class

[Visual Basic]
Overloads Public Sub New()
[C#]
public SpanConfiguration();

See Also

SpanConfiguration Class | SpanConfiguration Members | Dart.PowerTCP.Zip Namespace


SpanConfiguration Properties

The properties of the SpanConfiguration class are listed below. For a complete list of SpanConfiguration class members, see the SpanConfiguration Members topic.

Public Instance Properties

FirstPartSize | Gets or sets the size (in kilobytes) of the first part of a multi-part zip archive.
IsRemovableMedia | Gets or sets whether the target media is removable.
MinFreeSpace | Gets or sets the minimum free space on each removable media in kilobytes.
PartSize | Gets or sets the size (in kilobytes) of the target volume that holds one part of a multi-part zip archive.

See Also

SpanConfiguration Class | Dart.PowerTCP.Zip Namespace


SpanConfiguration.FirstPartSize Property

Gets or sets the size (in kilobytes) of the first part of a multi-part zip archive.

[Visual Basic]
Public Property FirstPartSize As Long
[C#]
public long FirstPartSize {get; set;}

Property Value

A long, representing the first part size. Its default value is 0, which implies that each volume involved in a spanning / splitting operation will be the same size as specified by the PartSize property.

Remarks

This property is only valid when using removable media (the IsRemovableMedia property is true). This property is used when the first removable disk has a size requirement that is different from the others

If this value is greater than the available capacity of the removable media, Exception will be set to a ZipException with the error code of NotEnoughSpaceForSpan and the Disk event will be raised requesting the same disk.

See Also

SpanConfiguration Class | SpanConfiguration Members | Dart.PowerTCP.Zip Namespace


SpanConfiguration.IsRemovableMedia Property

Gets or sets whether the target media is removable.

[Visual Basic]
Public Property IsRemovableMedia As Boolean
[C#]
public bool IsRemovableMedia {get; set;}

Property Value

Boolean specifying whether the target media is removable. Default is false.

Remarks

Its default value is false, which implies that the multi-part zip archive will be split and stored on the hard drive. When IsRemovableMedia is true, the archive is split into parts on removable media.

See Also

SpanConfiguration Class | SpanConfiguration Members | Dart.PowerTCP.Zip Namespace


SpanConfiguration.MinFreeSpace Property

Gets or sets the minimum free space on each removable media in kilobytes.

[Visual Basic]
Public Property MinFreeSpace As Long
[C#]
public long MinFreeSpace {get; set;}

Property Value

A long specifying the number of kilobytes to leave free on removable media. The default is 0.

Remarks

This property is only valid when the IsRemovableMedia property is true.

When the sum of MinFreeSpace and PartSize is greater than the capacity of the removable media, an exception will be set in Exception and a Disk event will be raised.

See Also

SpanConfiguration Class | SpanConfiguration Members | Dart.PowerTCP.Zip Namespace


SpanConfiguration.PartSize Property

Gets or sets the size (in kilobytes) of the target volume that holds one part of a multi-part zip archive.

[Visual Basic]
Public Property PartSize As Long
[C#]
public long PartSize {get; set;}

Property Value

A long specifying the size of a part in a spanned archive.

Remarks

When IsRemovableMedia is true, a zero value of this property implies that the spanning operation will use all of the available capacity of the removable media used. If IsRemovableMedia is false and the PartSize is 0 an exception will be thrown. When the available capacity of a removable media is smaller than PartSize, an exception will be thrown. PartSize should not exceed the available size of the removable media.

If PartSize is 0 and a removable disk is inserted with other data already present, all available space will be used and any pre-existing files will not be altered

See Also

SpanConfiguration Class | SpanConfiguration Members | Dart.PowerTCP.Zip Namespace


SpanProgressEventArgs Class

The status of the current on-going spanning operation

For a list of all members of this type, see SpanProgressEventArgs Members.

System.Object
EventArgs
SpanProgressEventArgs

[Visual Basic]
Public Class SpanProgressEventArgs
Inherits EventArgs
[C#]
public class SpanProgressEventArgs : EventArgs

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

SpanProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


SpanProgressEventArgs Members

Public Instance Constructors

SpanProgressEventArgs Constructor Creates an instance of the SpanProgressEventArgs

Public Instance Properties

FileNumber | The part number or the volume number that is currently undergoing a spanning operation.
Length | The total bytes of the compressed data to be spanned.
Position | The number of bytes that have been spanned.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Object) | Returns a String that represents the current Object.

See Also

SpanProgressEventArgs Class | Dart.PowerTCP.Zip Namespace


SpanProgressEventArgs Constructor

Creates an instance of the SpanProgressEventArgs

[Visual Basic]
Public Sub New( _
   ByVal spannedSize As Long, _
   ByVal spanSize As Long, _
   ByVal volumeNum As Integer _
)
[C#]
public SpanProgressEventArgs(
   long spannedSize,
   long spanSize,
   int volumeNum
);

See Also

SpanProgressEventArgs Class | SpanProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


SpanProgressEventArgs Properties

The properties of the SpanProgressEventArgs class are listed below. For a complete list of SpanProgressEventArgs class members, see the SpanProgressEventArgs Members topic.

Public Instance Properties

FileNumber | The part number or the volume number that is currently undergoing a spanning operation.
Length | The total bytes of the compressed data to be spanned.
Position | The number of bytes that have been spanned.

See Also

SpanProgressEventArgs Class | Dart.PowerTCP.Zip Namespace


SpanProgressEventArgs.FileNumber Property

The part number or the volume number that is currently undergoing a spanning operation.

[Visual Basic]
Public ReadOnly Property FileNumber As Integer
[C#]
public int FileNumber {get;}

Property Value

An integer representing a part or volume number.

Remarks

This can also indicate a disk number if the target media is removable.

See Also

SpanProgressEventArgs Class | SpanProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


SpanProgressEventArgs.Length Property

The total bytes of the compressed data to be spanned.

[Visual Basic]
Public ReadOnly Property Length As Long
[C#]
public long Length {get;}

Property Value

A long representing the total bytes of the compressed data to be spanned.

Remarks

This value represents the compressed data to be spanned into individual parts.

See Also

SpanProgressEventArgs Class | SpanProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


SpanProgressEventArgs.Position Property

The number of bytes that have been spanned.

[Visual Basic]
Public ReadOnly Property Position As Long
[C#]
public long Position {get;}

Property Value

A long, indicating how many bytes have been processed relative to ProgressEventArgs.Length.=

Remarks

This represents the cumulative number of compressed bytes that have been already spanned into parts.

See Also

SpanProgressEventArgs Class | SpanProgressEventArgs Members | Dart.PowerTCP.Zip Namespace


SpanProgressEventHandler Delegate

The delegate for the SpanProgress event.

[Visual Basic]
Public Delegate Sub SpanProgressEventHandler( _
   ByVal sender As Object, _
   ByVal e As SpanProgressEventArgs _
)
[C#]
public delegate void SpanProgressEventHandler(
   object sender,
   SpanProgressEventArgs e
);

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


Status Enumeration

Enumerates values which describe the current state of the compression operation.

[Visual Basic]
Public Enum Status
[C#]
public enum Status

Remarks

This enumeration is used by the Progress event.

Example

[Visual Basic, C#] The following example demonstrates using the Progress event.

[Visual Basic]

' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

Private Sub Archive1_Progress(ByVal sender As Object, ByVal e As Dart.PowerTCP.Zip.ProgressEventArgs) Handles Archive1.Progress
    Try
        'Set the progress bar and status when fires
        'prgItem is the progress bar for an individual item and prgTotal is for all the items.
        Select Case (e.Status)

            Case Status.Unzipping
                'Show item progress
                prgItem.Maximum = e.Item.Size
                prgItem.Value = e.processedItemBytes

                'Show total progress
                prgTotal.Maximum = e.TotalBytes
                prgTotal.Value = e.ProcessedTotalBytes

                Debug.WriteLine("Unzipping " + e.Item.Name)
            Case Status.EndUnzip
                prgTotal.Value = prgTotal.Maximum
        End Select
    Catch

    End Try
End Sub

[C#]

// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

private void archive1_Progress(object sender, Dart.PowerTCP.Zip.ProgressEventArgs e)
        {
            try
            {
                //Set the progress bar and status when fires
                //prgItem is the progress bar for an individual item and prgTotal is for all the items.
                switch (e.Status)
                {
                    case Status.Unzipping:
                        //Show item progress
                        prgItem.Maximum = (int)e.Item.Size;
                        prgItem.Value = (int)e.ProcessedItemBytes;

                        //Show total progress
                        prgTotal.Maximum = (int)e.TotalBytes;
                        prgTotal.Value = (int)e.ProcessedTotalBytes;

                        Debug.WriteLine("Unzipping " + e.Item.Name);
                        break;
                    case Status.EndUnzip:
                        prgTotal.Value = prgTotal.Maximum;
                        break;
                }
            }
            catch {}
        }

Members

Member Name | Description
BeginZip | Starting the compression operation.
Zipping | Compressing data.
BeginUnzip | Starting the decompression operation.
Unzipping | Decompressing data.
EndZip | The end of the compression operation.
EndUnzip | The end of the decompression operation.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

Dart.PowerTCP.Zip Namespace


ZipException Class

Used to catch the run-time exceptions during any operation of the Archive component.

For a list of all members of this type, see ZipException Members.

System.Object
Exception
ApplicationException
ZipException

[Visual Basic]
Public Class ZipException
Inherits ApplicationException
[C#]
public class ZipException : ApplicationException

Remarks

See ErrorCode for the complete list of the exceptions defined in the Archive component.

Requirements

Namespace: Dart.PowerTCP.Zip Namespace

Assembly: Dart.PowerTCP.Zip.dll

See Also

ZipException Members | Dart.PowerTCP.Zip Namespace


ZipException Members

Public Instance Constructors

ZipException Constructor Creates an instance of the ZipException class.

Public Instance Properties

ErrorCode | The code of the exception.
HelpLink (inherited from Exception) | Gets or sets a link to the help file associated with this exception.
InnerException (inherited from Exception) | Gets the Exception instance that caused the current exception.
Message (inherited from Exception) | Gets a message that describes the current exception.
Source (inherited from Exception) | Gets or sets the name of the application or the object that causes the error.
StackTrace (inherited from Exception) | Gets a string representation of the frames on the call stack at the time the current exception was thrown.
TargetSite (inherited from Exception) | Gets the method that throws the current exception.

Public Instance Methods

Equals (inherited from Object) | Determines whether the specified Object is equal to the current Object.
GetBaseException (inherited from Exception) | When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.
GetHashCode (inherited from Object) | Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetObjectData (inherited from Exception) | When overridden in a derived class, sets the SerializationInfo with information about the exception.
GetType (inherited from Object) | Gets the Type of the current instance.
ToString (inherited from Exception) | Creates and returns a string representation of the current exception.

See Also

ZipException Class | Dart.PowerTCP.Zip Namespace


ZipException Constructor

Creates an instance of the ZipException class.

[Visual Basic]
Public Sub New( _
   ByVal error As ErrorCode _
)
[C#]
public ZipException(
   ErrorCode error
);

See Also

ZipException Class | ZipException Members | Dart.PowerTCP.Zip Namespace


ZipException Properties

The properties of the ZipException class are listed below. For a complete list of ZipException class members, see the ZipException Members topic.

Public Instance Properties

ErrorCode | The code of the exception.
HelpLink (inherited from Exception) | Gets or sets a link to the help file associated with this exception.
InnerException (inherited from Exception) | Gets the Exception instance that caused the current exception.
Message (inherited from Exception) | Gets a message that describes the current exception.
Source (inherited from Exception) | Gets or sets the name of the application or the object that causes the error.
StackTrace (inherited from Exception) | Gets a string representation of the frames on the call stack at the time the current exception was thrown.
TargetSite (inherited from Exception) | Gets the method that throws the current exception.

See Also

ZipException Class | Dart.PowerTCP.Zip Namespace


ZipException.ErrorCode Property

The code of the exception.

[Visual Basic]
Public ReadOnly Property ErrorCode As ErrorCode
[C#]
public ErrorCode ErrorCode {get;}

Property Value

An ErrorCode enumeration specifying the error.

Remarks

This value can be used to identify the specific error during a Zip operation.

See Also

ZipException Class | ZipException Members | Dart.PowerTCP.Zip Namespace


Samples

The following samples are full applications which demonstrate usage of PowerTCP Zip Compression for .NET. The default directory for sample applications is C:\Program Files\PowerTCP\Zip for .NET\Samples (where the install drive letter is C:\).

The following table shows the samples for this release and their default install locations.

Sample | Language | Location
Folder Archive | VB.NET Windows Application C# Windows Application | C:\Program Files\PowerTCP\Zip for .NET\Samples\VB\FolderArchive C:\Program Files\PowerTCP\Zip for .NET\Samples\C#\FolderArchive
Stream Archive | VB.NET Windows Application C# Windows Application | C:\Program Files\PowerTCP\Zip for .NET\Samples\VB\StreamArchive C:\Program Files\PowerTCP\Zip for .NET\Samples\C#\StreamArchive
Unzipper | VB.NET Windows Application C# Windows Application Delphi .NET Windows Application | C:\Program Files\PowerTCP\Zip for .NET\Samples\VB\Unzipper C:\Program Files\PowerTCP\Zip for .NET\Samples\C#\Unzipper C:\Program Files\PowerTCP\Zip for .NET\Samples\Delphi\Unzipper
Web Archive | VB.NET Web Application C# Web Application | C:\Program Files\PowerTCP\Zip for .NET\Samples\VBASP\WebArchive C:\Program Files\PowerTCP\Zip for .NET\Samples\C#ASP\WebArchive
ZipManager | VB.NET Windows Application C# Windows Application | C:\Program Files\PowerTCP\Zip for .NET\Samples\VB\ZipManager C:\Program Files\PowerTCP\Zip for .NET\Samples\C#\ZipManager

Related Sections

Getting Started
Provides an overview of PowerTCP Zip Compression for .NET and discusses such topics as distribution, licensing, and support.
Using PowerTCP in VS.NET
Provides step-by-step instructions for creating a project using VS.NET, integrating PowerTCP Zip Compression for .NET, and creating a simple application.
Using the Archive Component
Discusses how to use the Archive component to compress/decompress files.
Using Events in PowerTCP
Discusses how to use the events provided by PowerTCP Zip Compression for .NET.
Reference
Provides a language/syntax reference for PowerTCP Zip Compression for .NET.

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Folder Archive Sample

Demonstrates a compression application that can be used to archive an entire folder recursively. Also demonstrates spanning operation.

Requirements

Components: Dart.PowerTCP.Zip.dll

Location

C:\Program Files\PowerTCP\Zip for .NET\Samples\VB\FolderArchive

--or--

C:\Program Files\PowerTCP\Zip for .NET\Samples\C#\FolderArchive

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Stream Archive Sample

Demonstrates a compression application that can be used to archive data in memory.

Requirements

Components: Dart.PowerTCP.Zip.dll

Location

C:\Program Files\PowerTCP\Zip for .NET\Samples\VB\StreamArchive

--or--

C:\Program Files\PowerTCP\Zip for .NET\Samples\C#\StreamArchive

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Unzipper Sample

Demonstrates a decompression application that can be used to decompress a file.

Requirements

Components: Dart.PowerTCP.Zip.dll

Location

C:\Program Files\PowerTCP\Zip for .NET\Samples\VB\Unzipper

--or--

C:\Program Files\PowerTCP\Zip for .NET\Samples\C#\Unzipper

--or--

C:\Program Files\PowerTCP\Zip for .NET\Samples\Delphi\Unzipper

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Web Archive Sample

Web-based ASP.NET sample that grabs all files of a web page (HTML, images, etc) and compresses them into a single zip file.

Requirements

Components: Dart.PowerTCP.Zip.dll

Location

C:\Program Files\PowerTCP\Zip for .NET\Samples\VBASP\WebArchive

--or--

C:\Program Files\PowerTCP\Zip for .NET\Samples\C#ASP\WebArchive

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Zip Manager Sample

Demonstrates a fully featured "WinZip" style zip manager.

Requirements

Components: Dart.PowerTCP.Zip.dll

Location

C:\Program Files\PowerTCP\Zip for .NET\Samples\VB\ZipManager

--or--

C:\Program Files\PowerTCP\Zip for .NET\Samples\C#\ZipManager

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Zipper Sample

Demonstrates a compression application that can be used to compress a file.

Requirements

Components: Dart.PowerTCP.Zip.dll

Location

C:\Program Files\PowerTCP\Zip for .NET\Samples\VB\Zipper

--or--

C:\Program Files\PowerTCP\Zip for .NET\Samples\C#\Zipper

--or--

C:\Program Files\PowerTCP\Zip for .NET\Samples\Delphi\Zipper

See Also

Using PowerTCP in VS.NET | Using the Archive Component | Zip Compression for .NET Reference

Send comments on this topic.

© 2004 Dart Communications. All rights reserved.


Archive.Add Method (String, Boolean, String, Boolean)

Add a file or multiple files to the archive with extended configuration options.

[Visual Basic]
Overloads Public Sub Add( _
   ByVal source As String, _
   ByVal includeSubs As Boolean, _
   ByVal excludePattern As String, _
   ByVal preservePath As Boolean _
)
[C#]
public void Add(
   string source,
   bool includeSubs,
   string excludePattern,
   bool preservePath
);

Parameters

source
A filepath of a file to add to the archive, or a filepath including wildcards specifying multiple files to add to the archive.
includeSubs
If source refers to a directory and includeSubs is true, subdirectories under the main directory are also added to the archive. If includeSubs is false, subdirectories are ignored.
excludePattern
If source refers to multiple files excludePattern is a wildcard pattern which controls which files are excluded, if any.
preservePath
true if the file(s) refered to by source keep their file paths within the archive.

Remarks

Use this method to add a file or multiple files (using wildcards) to the archive. Control how files are added by using the paramaters of this method. Compress the added files by using the Zip method.

Encryption options can be specified at the Archive or ArchiveItem level.

Example

[Visual Basic, C#] The following example demonstrates several Add techniques and a zip operation.

[Visual Basic]
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

'Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

'Add a comment to this item
item.Comment = "This is file1.txt"

'Use encryption for jus this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

'Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

'Add a wildcard collection of files
'In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
'Subfolders are not included, but the paths are preserved.
Archive1.Add("c:\Test\*.txt", False, "file1.txt", True)

'zip the data
Archive1.Zip("c:\test.zip")
[C#]
// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

//Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

//Add a comment to this item
item.Comment = "This is file1.txt";

//Use encryption for jus this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

//Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

//Add a wildcard collection of files
//In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
//Subfolders are not included, but the paths are preserved.
archive1.Add("c:\\Test\\*.txt", false, "file1.txt", true);

//Zip the data
archive1.Zip("c:\\test.zip");

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Add Overload List


Archive.Insert Method (Int32, String, Boolean, String, Boolean)

Insert one or files to the collection starting from the specified index.

[Visual Basic]
Overloads Public Sub Insert( _
   ByVal index As Integer, _
   ByVal source As String, _
   ByVal includeSubs As Boolean, _
   ByVal excludePattern As String, _
   ByVal preservePath As Boolean _
)
[C#]
public void Insert(
   int index,
   string source,
   bool includeSubs,
   string excludePattern,
   bool preservePath
);

Parameters

index
The zero-based index at which a file or files should be inserted.
source
A file or wildcard that is to be added to the Archive.
includeSubs
A boolean that indicates whether to include sub directories.
excludePattern
A string that indicates an exclusion pattern when adding multiple files
preservePath
A boolean that indicates whether to preserve the path of the file once its compressed.

Remarks

Please note that a spanned archive is not allowed to add or delete any items.

Exceptions

Exception Type | Condition
ArgumentOutOfRangeException | index is not a valid index.

See Also

Archive Class | Archive Members | Dart.PowerTCP.Zip Namespace | Archive.Insert Overload List


SelfExtractConfiguration Fields

The fields of the SelfExtractConfiguration class are listed below. For a complete list of SelfExtractConfiguration class members, see the SelfExtractConfiguration Members topic.

Public Instance Fields

Caption
EnableOverwrite
EnablePath
Overwrite
Path

See Also

SelfExtractConfiguration Class | Dart.PowerTCP.Zip Namespace