Professional Documents
Culture Documents
Website:
Sales:
Telephone:
http://www.componentone.com
sales@componentone.com
1.800.858.2739 or 1.412.681.4343 (Pittsburgh, PA USA Office)
Trademarks
The ComponentOne product name is a trademark and ComponentOne is a registered trademark of GrapeCity, Inc.
All other trademarks used herein are the properties of their respective owners.
Warranty
ComponentOne warrants that the media on which the software is delivered is free from defects in material and
workmanship, assuming normal use, for a period of 90 days from the date of purchase. If a defect occurs during this
time, you may return the defective media to ComponentOne, along with a dated proof of purchase, and
ComponentOne will replace it at no charge. After 90 days, you can obtain a replacement for the defective media by
sending it and a check for $25 (to cover postage and handling) to ComponentOne.
Except for the express warranty of the original media on which the software is delivered is set forth here,
ComponentOne makes no other warranties, express or implied. Every attempt has been made to ensure that the
information contained in this manual is correct as of the time it was written. ComponentOne is not responsible for
any errors or omissions. ComponentOnes liability is limited to the amount you paid for the product. ComponentOne
is not liable for any special, consequential, or other damages for any reason.
Table of Contents
Zip for .NET Overview .............................................................................................................. 9
Help with WinForms Edition ................................................................................................ 9
Creating a Mobile Device Application................................................................................... 9
Migrating a Zip for .NET Project to Visual Studio 2005........................................................ 10
Key Features .......................................................................................................................... 11
Zip for .NET Fundamentals..................................................................................................... 13
High Level: C1ZipFile, C1ZipEntry and C1ZipEntryCollection Classes ................................... 13
Medium Level: C1ZStreamReader and C1ZStreamWriter Classes ....................................... 15
Low Level: ZStream Class ................................................................................................... 17
Zip for Mobile Devices Fundamentals .................................................................................... 17
Zip for .NET Samples .............................................................................................................. 18
Zip for .NET Task-Based Help ................................................................................................. 19
Compressing Datasets ....................................................................................................... 20
Compressing an Entire Folder into a Zip File....................................................................... 22
Creating a Zip File with Multiple Entries ............................................................................. 23
Extracting Files from Zip Entry to Memory ......................................................................... 24
Reading a Zipped File Using a StreamReader...................................................................... 25
Retrieving Images from a Zip File ....................................................................................... 26
Saving a String Variable to a Zip File ................................................................................... 29
Setting the Level of Compression ....................................................................................... 31
Using Passwords to Protect Zip Files .................................................................................. 31
Zip for .NET Tutorials ............................................................................................................. 33
Compressing Data in Memory ............................................................................................ 34
Compressing Files .............................................................................................................. 45
Compressed Serialization ................................................................................................... 55
Handling Zip Files ............................................................................................................... 65
Zip for .NET Frequently Asked Questions ............................................................................... 82
API Reference ........................................................................................................................ 82
C1.C1Zip.4 Assembly.......................................................................................................... 82
Namespaces .................................................................................................................. 82
C1.C1Zip Namespace.................................................................................................. 82
Overview................................................................................................................ 82
Classes ................................................................................................................... 84
C1ZipEntry.......................................................................................................... 84
Overview ........................................................................................................ 84
Members ........................................................................................................ 85
Methods ......................................................................................................... 87
CheckCRC32 Method .................................................................................. 87
CheckPassword Method ............................................................................. 88
Extract Method........................................................................................... 89
OpenReader Method .................................................................................. 90
Remove Method ......................................................................................... 90
Properties ....................................................................................................... 91
Attributes Property ..................................................................................... 92
Comment Property ..................................................................................... 92
CRC32 Property .......................................................................................... 93
Date Property ............................................................................................. 93
FileName Property ...................................................................................... 94
IsEncrypted Property .................................................................................. 95
SizeCompressed Property ........................................................................... 95
SizeCompressedLong Property .................................................................... 96
SizeUncompressed Property ....................................................................... 96
SizeUncompressedLong Property ................................................................ 97
C1ZipEntryCollection .......................................................................................... 98
Overview ........................................................................................................ 98
Members ........................................................................................................ 99
Methods ........................................................................................................100
Add Method ..............................................................................................101
Add(String) Method ...............................................................................102
Add(String[]) Method .............................................................................102
Add(String,Int32) Method ......................................................................103
Add(String,String) Method .....................................................................104
Add(String,String,DateTime) Method .....................................................106
Add(Stream,String) Method ...................................................................107
Add(Stream,String,DateTime) Method ...................................................108
AddFolder Method ....................................................................................109
C1ZStreamReader Constructor.......................................................................181
C1ZStreamReader Constructor(Stream) .....................................................182
C1ZStreamReader Constructor(Stream,Boolean,Int32)...............................183
C1ZStreamReader Constructor(Stream,Boolean)........................................184
C1ZStreamReader Constructor(Stream,Boolean,Boolean) ..........................185
C1ZStreamReader Constructor(Stream,Boolean,Int32,Int32) .....................186
C1ZStreamReader Constructor(Stream,Boolean,Int64,Int32) .....................188
Methods ........................................................................................................189
Close Method ............................................................................................190
Flush Method ............................................................................................191
Read Method.............................................................................................192
ReadByte Method ......................................................................................193
Seek Method .............................................................................................194
SetLength Method .....................................................................................194
Write Method ............................................................................................195
Properties ......................................................................................................196
BaseStream Property .................................................................................197
CanRead Property ......................................................................................198
CanSeek Property ......................................................................................198
CanWrite Property .....................................................................................199
Length Property .........................................................................................200
OwnsBaseStream Property ........................................................................200
Position Property .......................................................................................201
SizeCompressed Property ..........................................................................201
SizeCompressedLong Property ...................................................................202
SizeUncompressed Property ......................................................................202
SizeUncompressedLong Property ...............................................................203
ZStream Property.......................................................................................203
C1ZStreamWriter...............................................................................................204
Overview .......................................................................................................206
Members .......................................................................................................207
C1ZStreamWriter Constructor........................................................................210
C1ZStreamWriter Constructor(Stream) ......................................................211
C1ZStreamWriter Constructor(Stream,Boolean).........................................212
ZipProgressEventArgs ........................................................................................240
Overview .......................................................................................................241
Members .......................................................................................................242
Properties ......................................................................................................243
Cancel Property .........................................................................................243
FileLength Property....................................................................................244
FileLengthLong Property ............................................................................244
FileName Property .....................................................................................245
Position Property .......................................................................................245
PositionLong Property................................................................................246
Enumerations ........................................................................................................246
CompressionLevelEnum ....................................................................................246
Delegates ..............................................................................................................247
ZipProgressEventHandler ..................................................................................247
C1.C1Zip.ZLib Namespace .........................................................................................248
Overview...............................................................................................................248
Classes ..................................................................................................................249
ZStream.............................................................................................................249
Overview .......................................................................................................250
Members .......................................................................................................251
ZStream Constructor......................................................................................254
ZStream Constructor() ...............................................................................254
ZStream Constructor(Boolean)...................................................................255
Methods ........................................................................................................256
deflate Method..........................................................................................257
deflateEnd Method ....................................................................................258
deflateInit Method.....................................................................................259
deflateInit(Int32) Method ......................................................................259
deflateInit(Int32,Int32) Method .............................................................260
deflateParams Method ..............................................................................262
deflateSetDictionary Method .....................................................................262
inflate Method...........................................................................................264
inflateEnd Method .....................................................................................265
inflateInit Method......................................................................................266
Getting Started
To get started, review
the following topics:
Zip for .NET classes are supported in all .NET development platforms
Key Features
Samples
See Also
Help with WinForms Edition
Creating a Mobile Device Application
Migrating a Zip for .NET Project to Visual Studio 2005
From the File menu in Microsoft Visual Studio .NET, select New | Project. The New
Project dialog box opens.
Under Project Types, expand the Visual Basic or Visual C# node. Note that one of
these options may be located under Other Languages.
Expand the Smart Device node and select one of the smart devices listed.
4.
Select Device Application from the list of Templates in the right pane.
5.
Enter a name in the Name textbox and click OK. A new project is created, and a new
Form1 is displayed in the Designer view.
Reference the C1Zip assembly in your project.
6.
Key Features
Some of the main features of Zip for .NET that you may find useful include the following:
Major operations
With Zip for .NET, you can:
C1ZStreamWriter is a stream object that takes regular data on input, compresses it, and
writes it out to an underlying stream. You can compress data to files, memory, or any
other type of stream. You can attach a BinaryWriter object to C1ZStreamWriter to
write objects directly, without dealing with byte arrays.
C1ZStreamReader is a stream object that takes a compressed stream as input and
decompresses it as it reads data from the underlying compressed stream. You can
attach a BinaryReader object to C1ZStreamReader to read objects directly, without
dealing with byte arrays.
C1ZipFile is a class that deals with zip files. It allows you to create, open, and modify zip
files. C1ZipFile has a Entries property that represents a collection of entries in a zip file.
Main Classes
Description
High
C1ZipFile, C1ZipEntry,
C1ZipEntryCollection
Medium C1ZStreamReader,
C1ZStreamWriter
Low
ZStream
See Also
High Level: C1ZipFile, C1ZipEntry and C1ZipEntryCollection Classes
Medium Level: C1ZStreamReader and C1ZStreamWriter Classes
Low Level: ZStream Class
You can consolidate many files into one, making application deployment easier.
You can compress the data, saving disk space and network bandwidth.
The zip format is an open standard, supported by many popular applications.
C1ZipFile Class
The C1ZipFile class encapsulates a zip file. After you create a C1ZipFile object, you can attach it
to an existing zip file or tell it to create a new empty zip file for you. For example:
To write code in Visual Basic
Visual Basic
Copy Code
Copy Code
C1ZipEntryCollection Class
After you have created or opened a zip file, use the Entries collection to inspect the contents of
the zip file, or to add, expand, and delete entries. For example:
To write code in Visual Basic
Visual Basic
Copy Code
myZip.Entries.Add("MyData.txt")
myZip.Entries.Add("MyData.xml")
myZip.Entries.Add("MyData.doc")
Dim zipEntry As C1ZipEntry
For Each zipEntry In
myZip.Entries
Console.WriteLine(zipEntry.FileName)
Next zipEntry
myZip.Open("Old.zip");
To write code in C#
C#
Copy Code
myZip.Entries.Add("MyData.txt");
myZip.Entries.Add("MyData.xml");
myZip.Entries.Add("MyData.doc");
foreach (C1ZipEntry zipEntry in myZip.Entries)
Console.WriteLine(zipEntry.FileName);
C1ZipEntry Class
The C1ZipEntry class exposes properties and methods that describe each entry, including its
original file name, size, compressed size, and so on. It also has a OpenReader method that
returns a stream object, so you can read the entry contents without expanding it first.
For example, the code below saves an ADO.NET DataTable object into a stream and then reads
it back:
To write code in Visual Basic
Visual Basic
Copy Code
Copy Code
Copy Code
fout.Close()
' Read the compressed data.
Dim fin As New FileStream("test.tmp", FileMode.Open)
Dim decompressor As New C1ZStreamReader(fin)
Dim DataTableIn As DataTable = bf.Deserialize(decompressor)
To write code in C#
C#
Copy Code
Zip for Mobile supports all members of the object model that are supported by the .NET
Compact Framework.
Note that the code examples provided in this documentation are examples for using Zip for
.NET. If you would like to see samples for the mobile version, they are installed with Zip for
Mobile Devices, or you can get them online at
http://helpcentral.componentone.com/Samples.aspx.
Documents\ComponentOne Samples\WinForms
Click one of the following links to view a list of C1Zip samples:
Visual Basic Samples
Sample
Description
Files
Shows how to compress and expand individual files. This sample calls the
C1.C1Zip namespace.
Memory
Shows how to compress and expand memory streams. This sample calls the
C1.C1Zip namespace.
Serialization
Shows how to add compression to the .NET serialization support. This sample
calls the C1.C1Zip namespace.
ZipFileDemo Shows how to implement a simple zip utility. This sample uses the C1.C1Zip
namespace.
ZipFileSimple Shows how to implement a simple zip utility. This sample lets you create, open,
and edit standard zip files. Note that this is a stripped-down version of the
ZipFileDemo sample.
C# Samples
Sample
Description
Files
Shows how to compress and expand individual files. This sample calls
the C1.C1Zip namespace.
InMemoryCompression Shows how to create and use an in-memory archive. This sample calls
the C1.C1Zip namespace.
Memory
SelfExtract
Serialization
ZipFileDemo
Shows how to implement a simple zip utility. This sample uses the
C1.C1Zip namespace.
ZipImages
Shows how to retrieve images directly from a zip file. This sample calls
the C1.C1Zip namespace.
Description
DataSet
Add compression to the .NET serialization support. This sample calls the
C1.C1Zip namespace.
LongString Compress and expand strings. This sample calls the C1.C1Zip namespace.
ZipFile
Implement a simple zip utility. This sample calls the C1.C1Zip namespace.
Each task-based help topic provides a solution for specific tasks referencing the C1.C1Zip
namespace. Each topic also assumes that you have created a new .NET project.
See Also
Compressing Datasets
Compressing an Entire Folder into a Zip File
Creating a Zip File with Multiple Entries
Extracting Files from Zip Entry to Memory
Reading a Zipped File Using a StreamReader
Retrieving Images from a Zip File
Saving a String Variable to a Zip File
Setting the Level of Compression
Using Passwords to Protect Zip Files
Compressing Datasets
To write a dataset into a compressed zip file, use the following code:
To write code in Visual Basic
Visual Basic
Copy Code
zip.Open("c:\temp\dataset.zip")
' Read the dataset from the zip file.
Dim dsTest As New DataSet(ds.DataSetName) '
Dim s As Stream = zip.Entries(ds.DataSetName).OpenReader()
Try
dsTest.ReadXml(s)
Finally
s.Dispose()
End Try
' Check that the datasets are equivalent.
Dim i As Integer
For i = 0 To ds.Tables.Count - 1
Dim dt1 As DataTable = ds.Tables(i)
Dim dt2 As DataTable = dsTest.Tables(i)
Debug.Assert((dt1.TableName = dt2.TableName And dt1.Columns.Count =
dt2.Columns.Count And dt1.Rows.Count = dt2.Rows.Count))
Next i
End Sub
To write code in C#
C#
Copy Code
Copy Code
Copy Code
Copy Code
C1Zip.Entries.ExtractFolder("c:\temp\")
To write code in C#
C#
Copy Code
C1Zip.Entries.ExtractFolder(@"c:\temp\");
Copy Code
To write code in C#
C#
Copy Code
Syntax
Visual Basic (Declaration)
Public Property TextCaptionText As System.String
C#
public System.string TextCaptionText {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1PreviewTextSearchPanel Class
C1PreviewTextSearchPanel Members
Copy Code
Copy Code
Copy Code
' Build a list of images in resource directory, and add them all to a zip
file.
Dim zip As New C1ZipFile()
Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
' Get the application directory.
Dim s As String = Application.ExecutablePath
s = s.Substring(0, s.IndexOf("\bin")) + "\resources"
' Create the zip file.
zip.Create((s + "\images.zip"))
' Populate the zip file and list.
Dim f As String
For Each f In
Directory.GetFiles(s)
To write code in C#
C#
Copy Code
// Build a list of images in resource directory, and add them all to a zip
file.
C1ZipFile zip = new C1ZipFile();
private void Form1_Load(object sender, System.EventArgs e)
{
// Get the application directory.
string s = Application.ExecutablePath;
s = s.Substring(0, s.IndexOf(@"\bin")) + @"\resources";
// Create the zip file.
zip.Create(s + @"\images.zip");
// Populate the zip file and list.
foreach (string f in Directory.GetFiles(s))
{
string fname = f.ToLower();
// Skip self.
if (fname.EndsWith("zip")) continue;
// Add to the list.
listBox1.Items.Add(Path.GetFileName(fname));
// Add to the zip file.
zip.Entries.Add(fname);
}
}
To allow you to select an image, retrieve a stream with the image data (OpenReader method),
and load the image (Image.FromStream method), add the following code to the
SelectedIndexChanged event:
To write code in Visual Basic
Visual Basic
Copy Code
Copy Code
C1ZipEntryCollection.OpenWriter method
Use the OpenWriter method to get a stream writer, write the string into it, and then
close it. The data is compressed as you write it into the stream, and the whole stream is
saved into the zip file when you close it.
MemoryStream method
Use a MemoryStream method; write the data into it, and then add the stream to the
zip file. Note that this method requires a little more work than the OpenWriter method,
but is still very manageable.
The following code shows both methods. Add the code to the Button_Click event:
To write code in Visual Basic
Visual Basic
Copy Code
buds of May, " + "And summer's lease hath all too short a date."
Dim zipFile As New C1ZipFile()
zipFile.Create("c:\temp\strings.zip")
' Method 1: OpenWriter.
Dim stream As Stream = zipFile.Entries.OpenWriter("Shakespeare.txt",
True)
Dim sw As New StreamWriter(stream)
sw.Write(str)
sw.Close()
' Method 2: Memory Stream.
stream = New MemoryStream()
sw = New StreamWriter(stream)
sw.Write(str)
sw.Flush()
stream.Position = 0
zipFile.Entries.Add(stream, "Shakespeare2.txt")
stream.Close()
End Sub
To write code in C#
C#
Copy Code
stream.Position = 0;
zipFile.Entries.Add(stream, "Shakespeare2.txt");
stream.Close();
}
Copy Code
Copy Code
string fn = Path.GetTempFileName();
FileStream fs = new FileStream(fn, FileMode.Create);
C1ZStreamWriter compressor = new
C1ZStreamWriter(fs,CompressionLevelEnum.BestCompression);
Note that the code sample above sets the compression level to BestCompression, which has
the highest compression time and the lowest speed. Other compression level options on the
C1ZStreamWriter's constructor include the following:
Visual Basic
Copy Code
C1Zip.Password = "password"
C1Zip.Entries.Add(someFile)
To write code in C#
C#
Copy Code
C1Zip.Password = "password";
C1Zip.Entries.Add(someFile);
To extract this entry later, the Password property must be set to the same value in effect when
the entry was added. For example:
To write code in Visual Basic
Visual Basic
Copy Code
Copy Code
// Will succeed.
C1Zip.Password = "password";
C1Zip.Entries.Extract(someFile);
Description
Compressing
Shows how you can compress and expand arbitrary data in memory. This
Data in Memory
technique is useful in any situation where you keep memory streams while
the application is running. By compressing the streams, you can reduce the
memory requirements for your application.
Compressing
Shows how you can compress individual files so they take up less disk space
Files
and are less exposed to access by users. Note that these are not zip files, just
individual compressed files. The last tutorial covers zip files.
Compressed
Shows how you can combine Zip with .NET serialization to save objects into
Serialization
streams that are a fraction of the regular size. If you are serializing objects
into XML streams, the savings in disk space and network bandwidth can be
huge.
Handling Zip
Shows how you can open, inspect, add, and remove files in a zip archive.
Files
Using the zip format for your application storage needs has several
advantages: it is an open-standard, well-documented, space-efficient format.
See Also
Compressing Data in Memory
Compressing Files
Compressed Serialization
Handling Zip Files
Four Button controls along the left edge of the form, as shown in the picture above. In
the Properties window make the following changes to each Button control:
Button
Button.Text Property
Button.Name Property
Button.Enabled Property
Compress String
btnCompressString
True (Default)
Decompress String
btnExpandString
False
Compress Data
btnCompressData
True (Default)
Decompress Data
btnExpandData
False
Note: The Decompress String and Decompress Data buttons cannot be used until we
have some compressed data to expand.
A TextBox on the upper-right of the form. Set the MultiLine property to True. Select
the ellipsis button located next to Lines property. In the String Collection Editor
dialog box type text to use as an initial value.
Copy Code
Imports System.IO
Imports C1.C1Zip
To write code in C#
C#
using System.IO;
using C1.C1Zip;
Copy Code
This makes the objects defined in the C1Zip assembly visible to the project and saves a lot of
typing.
Copy Code
Copy Code
m_CompressedString = CompressString(textBox1.Text);
// Tell the user how long it took.
int ms = (int)((DateTime.Now.Ticks - ticks) /
TimeSpan.TicksPerMillisecond);
int lenBefore = textBox1.Text.Length * 2;
int lenAfter = m_CompressedString.Length;
string msg = string .Format("Compressed from {0} bytes to " + "{1} bytes
in {2} milliseconds.", lenBefore, lenAfter, ms);
MessageBox.Show(msg, "Compressed", MessageBoxButtons.OK,
MessageBoxIcon.Information);
// We can now expand it.
btnExpandString.Enabled = true;
}
The first main line declares a member variable called m_CompressedString which will be used
to hold the compressed data (encoded as a byte array). The second main line calls a utility
function CompressString that compresses a given string into a byte array that can later be
expanded to restore the original string. The remainder of the code is used to measure how long
the compression process took and to show a dialog box with statistics.
(Note that the lenBefore variable is calculated as the length of the string times two. This is
because .NET strings are Unicode, and each character actually takes up two bytes.)
Add the following code which implements the CompressString function:
To write code in Visual Basic
Visual Basic
Copy Code
To write code in C#
C#
Copy Code
After the StreamWriter is set up, all we need to do is call its Write method to write the string
into the compressed memory stream. When done writing, we also call the Flush method to
make sure all cached input is written out.
Finally, the code uses the ToArray method to return the byte array that was created by the
memory stream.
Copy Code
Copy Code
msg;
msg = string .Format("Expanded from {0} bytes to {1} bytes " + "in {2}
milliseconds.", lenBefore, lenAfter, ms);
MessageBox.Show(msg, "Expanded", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
The main line calls the utility function ExpandString that takes a byte array and returns the
original string. Add the following code for the ExpandString function:
To write code in Visual Basic
Visual Basic
Copy Code
Copy Code
Copy Code
bw.Write(Math.Cos(a))
Next i
' Flush any pending output.
bw.Flush()
' Save the compressed data.
m_CompressedData = ms.ToArray()
' Done.
Dim msg As String
msg =String.Format("Generated table with {0} points," & " saved into {1}
bytes", count, m_CompressedData.Length)
Label1.Text = msg
' We can now expand it.
btnExpandData.Enabled = True
End Sub
To write code in C#
C#
Copy Code
bw.Flush();
// Save the compressed data.
m_CompressedData = ms.ToArray();
// Done.
string
msg;
Copy Code
Copy Code
msg;
If you run the project and click the compress/decompress data buttons, you will see that the
data is saved in an array with 14,125 bytes. To save this data in a regular stream, it would take [4
+ 1000 * (4 + 8 * 3)] = 28,004 bytes. So we compressed it to about half the original size.
This concludes the Compressing Data in Memory tutorial.
Compressing Files
This tutorial shows how you can compress and expand individual files. Note that these are not
zip files; they are just compressed streams on disk. Zip files are covered in the Handling Zip Files
tutorial. Here is what the final application will look like:
Two Button controls along the left edge of the form, as shown in the picture above. In
the Properties window make the following changes:
Button
Button.Text Property
Button.Name Property
Button.Enabled Property
Compress Files
btnCompress
True (Default)
Expand Files
btnExpand
False
Note that the Expand Files button cannot be used until we have some compressed files
to expand.
A Label control on the right of the buttons. This control will display statistics about the
compression/expanding process.
Copy Code
Imports System.IO
Imports C1.C1Zip
To write code in C#
C#
Copy Code
using System.IO;
using C1.C1Zip;
This makes the objects defined in the C1Zip and System.IO assemblies visible to the project
and saves a lot of typing.
Step 3: Define the directory names for the compressed and expanded
files.
In the Code Editor of the form, define the following constants:
To write code in Visual Basic
Visual Basic
Copy Code
Copy Code
Copy Code
Copy Code
"Original size:
label1.Text = msg;
// Now we can expand.
btnExpand.Enabled = true;
}
The main line calls the utility function CompressFile utility method to compress each selected
file. The compressed files are stored in the \compressed directory under the application folder.
They have the same name as the original file, plus a CMP extension.
Add the following code for the CompressFile function:
To write code in Visual Basic
Visual Basic
Copy Code
C#
Copy Code
dstFile, string
srcFile)
{
// Prepare to compress file.
bool retval = true;
FileStream srcStream = null;
FileStream dstStream = null;
try
{
// Open the files.
srcStream = new FileStream(srcFile, FileMode.Open, FileAccess.Read);
dstStream = new FileStream(dstFile, FileMode.Create,
FileAccess.Write);
// Open a compressor stream on the destination file.
C1ZStreamWriter sw = new C1ZStreamWriter(dstStream);
// Copy the source into the compressor stream.
StreamCopy(sw, srcStream);
}
catch
{
// Exception? Tell the caller we failed.
retval = false;
}
finally
{
// Always close our streams.
if (srcStream != null) srcStream.Close();
if (dstStream != null) dstStream.Close();
}
// Done.
return false;
}
The function starts by creating two new file streams: one for the source file and one for the
compressed file. Then it creates a C1ZStreamWriter object and attaches it to the destination
stream. Next, it calls the StreamCopy function to transfer data from the source file and write it
into the compressor stream.
Finally, the function closes both streams. Note the use of the Finally statement to ensure that
both streams are properly closed even if there are exceptions while the function is executing.
The StreamCopy function simply copies bytes from one stream to another. Here's the code:
Copy Code
Copy Code
Copy Code
= appPath.IndexOf("\bin\")
C#
Copy Code
Path.GetFileName(srcFile);
dstFile = dstFile.Replace(".cmp", "");
ExpandFile(dstFile, srcFile);
// Update stats.
count++;
size += new FileInfo(srcFile).Length;
sizeExpanded += new FileInfo(dstFile).Length;
}
// Show stats.
string msg = string .Format("Expanded {0} files in {1} ms.\r\n" +
"Original size:
Copy Code
Copy Code
try
{
// Open the files.
srcStream = new FileStream(srcFile, FileMode.Open, FileAccess.Read);
dstStream = new FileStream(dstFile, FileMode.Create,
FileAccess.Write);
// Open an expander stream on the compressed source.
C1ZStreamReader sr = new C1ZStreamReader(srcStream);
// Copy the expander stream into the destination file.
StreamCopy(dstStream, sr);
}
catch
{
// Exception? Tell the caller we failed.
retval = false;
}
finally
{
// Always close our streams.
if (srcStream != null) srcStream.Close();
if (dstStream != null) dstStream.Close();
}
// Done.
return retval;
}
The function is similar to CompressFile, except it attaches a C1ZStreamReader to the source
stream instead of attaching a C1ZStreamWriter to the destination stream.
This concludes the Compressing Files tutorial.
Compressed Serialization
This tutorial shows how you can serialize objects in compressed files, and then load them back
into the memory.
The sample creates a data table using the NorthWind database. The table is saved (serialized)
into regular and compressed streams. Finally, the data is loaded back from either stream. Here
is what the final application will look like:
Four Button controls along the left edge of the form, as shown in the picture above. In
the Properties window make the following changes to each Button control:
Button Button.Text Property
Button.Name Property
Button.Enabled Property
btnCreate
True (Default)
btnSave
False
btnLoad
False
btnLoadCompressed
False
Note that the save and load buttons cannot be used until the data table has been
created or saved.
A DataGridView control on the right of the form.
A ToolStripStatusLabel control docked at the bottom of the form. To add this control,
first add a StatusStrip control to the form. Then click the Add ToolStripStatusLabel
drop-down arrow and select StatusLabel. A ToolStripStatusLabel control appears and
is docked at the bottom of the form.
Go to the Solution Explorer window and click the Show All Files button. Right-click on
References, and select the Add Reference menu option. Select the C1.C1Zip assembly from the
list, or browse to find the C1.C1Zip.2.dll file.
Select the Form1.vb tab (Form1.cs in C#) or go to View|Code to open the Code Editor. At the
top of the file, add the following statements:
To write code in Visual Basic
Visual Basic
Copy Code
Imports System.IO
Imports System.Data.OleDb
Imports System.Runtime.Serialization.Formatters.Binary
Imports C1.C1Zip
To write code in C#
C#
Copy Code
using System.IO;
using System.Data.OleDb;
using System.Runtime.Serialization.Formatters.Binary;
using C1.C1Zip;
This declares the namespaces of the classes used in the project.
Copy Code
C#
Copy Code
Copy Code
Copy Code
+ ";";
string rs = "select * from customers";
// Show status.
Cursor = Cursors.WaitCursor;
toolStripStatusLabel1.Text = "Loading data from mdb file...";
// Load data.
OleDbDataAdapter da = new OleDbDataAdapter(rs, conn);
DataSet ds = new DataSet();
try
{
da.Fill(ds);
}
catch
{
MessageBox.Show("Could not load data from " + MDBFILE);
}
// Show status.
Cursor = Cursors.Default;
toolStripStatusLabel1.Text = "Loaded " + ds.Tables[0].Rows.Count +
"
Add the following code to handle the Click event for the Save Data Table button:
To write code in Visual Basic
Visual Basic
Copy Code
C#
Copy Code
In both cases, the serialization is executed by the BinaryFormatter object. The only difference is
that in the first case, the Serialize method is called with a regular file stream as a parameter; in
the second, a C1ZStreamWriter is used instead.
Step 6: Add code to load the data table from the regular file.
Add the following code to handle the Click event for the Load Data Table button:
To write code in Visual Basic
Visual Basic
Copy Code
Copy Code
Cursor = Cursors.WaitCursor;
dataGridView1.DataSource = null;
toolStripStatusLabel1.Text = "Loading from regular file...";
// Deserialize from regular file.
string fn = Application.StartupPath + FN_REGULAR;
FileStream fs = new FileStream(fn, FileMode.Open);
long ticks = DateTime.Now.Ticks;
BinaryFormatter bf = new BinaryFormatter();
DataTable dt = (DataTable)bf.Deserialize(fs);
long ms = (DateTime.Now.Ticks - ticks) / TimeSpan.TicksPerMillisecond;
fs.Close();
// Show result.
Cursor = Cursors.Default;
dataGridView1.DataSource = dt;
toolStripStatusLabel1.Text = "Loaded from regular file in " +
ms.ToString() + " ms.";
}
The first main line of code creates a new BinaryFormatter object and the second one calls its
Deserialize method. The Deserialize method takes a single parameter: the stream in which the
object is defined. In this case, the stream is a regular file stream.
Step 7: Add code to load the data table from the compressed file.
Add the following code to handle the Click event for the Load Compressed Data Table button:
To write code in Visual Basic
Visual Basic
Copy Code
= DateTime.Now.Ticks
Copy Code
Note: This is a very simple application, designed to highlight the main functionality of the
C1ZipFile object. The distribution disk also includes a more sophisticated version, which
supports more advanced features such as drag and drop, zipping folders, setting the
compression level, and so on.
Button
Button.Text Property
Button.Name Property
btnNew
btnOpen
Add Files
btnAdd
Extract Files
btnExtract
Remove Files
btnRemove
View File
btnView
btnTest
A ListView control covering the right part of the form. In the Properties
window, click on the ellipsis button next to the Columns property. The
ColumnHeader Collection Editor dialog box appears.
Note: The Column Header Collection Editor can also be accessed by clicking Edit
Columns in the ListView Tasks menu. To access the ListView Tasks menu, click the smart
tag ( ) in the upper right corner of the ListView control.
2.
Click the Add button to add five ColumnHeaders, and then set the Text property of
each column to File, Date, Size, Compressed, and Amount, respectively.
Here is what the ColumnHeader Collection Editor should look like:
3.
Copy Code
Imports System.IO
Imports C1.C1Zip
To write code in C#
C#
Copy Code
using System.IO;
using C1.C1Zip;
This makes the objects defined in the C1Zip and System.IO assemblies visible to the project.
Copy Code
Copy Code
Copy Code
Copy Code
Copy Code
Copy Code
Copy Code
Try
m_Zip.Open(fo.FileName)
Catch
MessageBox.Show("Invalid ZIP file, please try again.")
End Try
' Update display.
UpdateDisplay()
End Sub
To write code in C#
C#
Copy Code
Visual Basic
Copy Code
Copy Code
Copy Code
Copy Code
function returns true if the values match and false if they don't (which indicates the entry is
corrupted).
Copy Code
C#
Copy Code
entryText = sr.ReadToEnd();
entry.Close();
// Make sure the entry is not too big for the MessageBox.
if (entryText.Length > 16000 )
{
entryText = entryText.Substring(0, 16000);
}
// Show the entry in the message box.
MessageBox.Show(entryText, ze.FileName);
}
The function starts by choosing the first selected zip entry that is not a subdirectory. If a valid
entry cannot be found, the function exits.
The function then calls the OpenReader method to obtain a Stream that can be used to read
the contents of the entry. There are no temporary files or additional delays involved in this step;
the data is expanded as it is read from the stream.
Next, the function reads the entry content directly into a string using the ReadToEnd method
on the StreamReader object, then closes the stream.
Finally, the string is truncated and displayed in a message box.
Note that this function was designed to show the contents of short text files. If you try to view
the contents of binary files, it will show only a couple of characters.
Copy Code
Copy Code
if (fo.ShowDialog() == DialogResult.OK)
{
// Add files in the list.
foreach (string file in fo.FileNames)
{
m_Zip.Entries.Add(file);
}
// Done.
UpdateDisplay();
}
}
Adding new entries to a zip file is easy. The main line simply calls the Add method on the
C1ZipFile object, passing a string that contains the full name of the file to be added. Thats all
there is to it.
Copy Code
Copy Code
msg;
msg = "Please confirm that you want to extract " + cnt.ToString() + "
entries.";
dr = MessageBox.Show(msg, "C1Zip", MessageBoxButtons.OKCancel,
MessageBoxIcon.Question);
if ( dr != DialogResult.OK )
return;
// Done.
UpdateDisplay();
}
The most important line calls the Extract method on the Entries property of the C1ZipFile object.
The parameter is the string that contains the file name of the entry (which is stored in the
entry's FileName property).
By default, the Extract method expands the entry and saves it in the same directory where the
zip file is located. There are other versions of this method that allow you to specify the
destination directory and file name for the expanded file. For more details, see the C1.C1Zip
Namespace section.
Step 12: Add code to remove entries from the zip file.
Add the following code to handle the Click event for the Remove Files command button:
To write code in Visual Basic
Visual Basic
Copy Code
Next lvi
' Done.
UpdateDisplay()
End Sub
To write code in C#
C#
Copy Code
msg;
msg = "Please confirm that you want to delete " + cnt.ToString() + "
entries.";
dr = MessageBox.Show(msg, "C1Zip", MessageBoxButtons.OKCancel,
MessageBoxIcon.Question);
if (dr != DialogResult.OK) return;
// Delete all selected entries.
foreach (ListViewItem lvi in listView1.SelectedItems)
{
C1ZipEntry ze = (C1ZipEntry)lvi.Tag;
if (ze.SizeCompressed > 0)
{
m_Zip.Entries.Remove(ze.FileName);
}
}
// Done.
UpdateDisplay();
}
The most important line calls the Remove method on the Entries property of the C1ZipFile
object. The parameter is the string that contains the file name of the entry (which is stored in
the entry's FileName property).
This concludes the Handling Zip Files tutorial.
API Reference
The following topics contain the API reference for Zip for .NET.
See Also
C1.C1Zip.4 Assembly
C1.C1Zip.4 Assembly
Namespaces
C1.C1Zip Namespace
Overview
Classes
Class
Description
C1ZipEntry
C1ZStreamReader
C1ZStreamWriter
ZipFileException
Delegates
Delegate
Description
Enumerations
Enumeration
Description
See Also
Reference
C1.C1Zip.4 Assembly
Classes
C1ZipEntry
Represents an entry in a zip file, and exposes information including the entry name, compressed
and uncompressed sizes, date, checksum, etc.
Object Model
Syntax
Visual Basic (Declaration)
Public Class C1ZipEntry
C#
public class C1ZipEntry
Inheritance Hierarchy
System.Object
C1.C1Zip.C1ZipEntry
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Members
C1.C1Zip Namespace
Overview
Represents an entry in a zip file, and exposes information including the entry name, compressed
and uncompressed sizes, date, checksum, etc.
Object Model
Syntax
Visual Basic (Declaration)
Public Class C1ZipEntry
C#
public class C1ZipEntry
Inheritance Hierarchy
System.Object
C1.C1Zip.C1ZipEntry
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Members
C1.C1Zip Namespace
Members
Properties Methods
Public Properties
Name
Description
Attributes
Comment
CRC32
Date
Gets the date and time when the file used to create the entry was
last modified.
FileName
IsEncrypted
SizeCompressed
SizeCompressedLong
SizeUncompressed
Public Methods
Name
Description
CheckCRC32
CheckPassword
Checks whether this C1ZipEntry can be read with the currently set
password.
Extract
OpenReader
Remove
Top
See Also
Reference
C1ZipEntry Class
C1.C1Zip Namespace
Methods
%%scrap%%
" -->
For a list of all members of this type, see C1ZipEntry members.
Public Methods
Name
Description
CheckCRC32
CheckPassword
Checks whether this C1ZipEntry can be read with the currently set
password.
Extract
OpenReader
Remove
Top
See Also
Reference
C1ZipEntry Class
C1.C1Zip Namespace
CheckCRC32 Method
Calculates a checksum value for the entry and compares it to the checksum that was stored
when the entry was created.
Syntax
Visual Basic (Declaration)
Return Value
True if the checksum values match, false otherwise.
Remarks
This method is used to check the integrity of the entries in the zip file. If the calculated
checksum does not match the stored checksum, then either the zip file is corrupted or the
program used to create the zip file is incompatible with C1Zip.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
CheckPassword Method
Checks whether this C1ZipEntry can be read with the currently set password.
Syntax
Visual Basic (Declaration)
Public Function CheckPassword() As Boolean
C#
public bool CheckPassword()
Return Value
True if the entry can be read with the current password, or if the entry is not encrypted.
Remarks
This method is more efficient than using a try/catch block and trying to open the entry to
determine whether the current password is valid for the entry.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
Extract Method
Name and location of the extracted file.
Extracts this entry to a file.
Syntax
Visual Basic (Declaration)
Public Sub Extract( _
ByVal destFileName As String _
)
C#
public void Extract(
string destFileName
)
Parameters
destFileName
Name and location of the extracted file.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
OpenReader Method
Returns a System.IO.Stream that can be used to read the content of the entry without extracting
it to a disk file.
Syntax
Visual Basic (Declaration)
Public Function OpenReader() As Stream
C#
public Stream OpenReader()
Return Value
A System.IO.Stream that can be used to read the data in the entry.
Remarks
The System.IO.Stream returned is a C1ZStreamReader, which decompresses the data as it is
read from the entry.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
Remove Method
Removes this entry from the zip file.
Syntax
Visual Basic (Declaration)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
Properties
>
Name
Description
Attributes
Comment
CRC32
Date
FileName
Gets the date and time when the file used to create the entry was
last modified.
Gets the entry name. This is usually a file name, optionally including
a path.
IsEncrypted
SizeCompressed
SizeCompressedLong
SizeUncompressed
SizeUncompressedLong
Top
See Also
Reference
C1ZipEntry Class
C1.C1Zip Namespace
Attributes Property
Gets the file attributes associated with the entry.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property Attributes As FileAttributes
C#
public FileAttributes Attributes {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
Comment Property
Gets or sets a comment associated with the entry.
Syntax
Visual Basic (Declaration)
Public Property Comment As String
C#
public string Comment {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
CRC32 Property
Gets the checksum calculated when the entry was compressed.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property CRC32 As Integer
C#
public int CRC32 {get;}
Remarks
This value can be used to check the integrity of the entry when it is decompressed.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
Date Property
Gets the date and time when the file used to create the entry was last modified.
Syntax
Remarks
This value can be used to check whether an entry needs to be updated because the source file
was modified since it was last compressed.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
FileName Property
Gets the entry name. This is usually a file name, optionally including a path.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property FileName As String
C#
public string FileName {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
IsEncrypted Property
Gets a value that determines whether the entry is encrypted.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property IsEncrypted As Boolean
C#
public bool IsEncrypted {get;}
Remarks
Encrypted entries can only be extracted if the C1ZipFile.Password property on the containing
C1ZipFile object is set to the password that was used when the file was added to the zip file.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
SizeCompressed Property
Gets the compressed size of the entry, in bytes.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property SizeCompressed As Integer
C#
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
SizeCompressedLong Property
Gets the compressed size of the entry, in bytes, as a long integer.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property SizeCompressedLong As Long
C#
public long SizeCompressedLong {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
SizeUncompressed Property
Gets the original (uncompressed) size of the entry, in bytes.
Syntax
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
SizeUncompressedLong Property
Gets the original (uncompressed) size of the entry, in bytes, as a long integer.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property SizeUncompressedLong As Long
C#
public long SizeUncompressedLong {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntry Class
C1ZipEntry Members
C1ZipEntryCollection
A collection of C1ZipEntry objects that represent the contents of a zip file.
Object Model
Syntax
Visual Basic (Declaration)
Public Class C1ZipEntryCollection
C#
public class C1ZipEntryCollection
Remarks
Use the C1ZipEntryCollection to programmatically manage the contents of zip files. You can
add, remove, extract, or insert items into the C1ZipEntryCollection.
Inheritance Hierarchy
System.Object
C1.C1Zip.C1ZipEntryCollection
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Members
C1.C1Zip Namespace
Overview
A collection of C1ZipEntry objects that represent the contents of a zip file.
Object Model
Syntax
Visual Basic (Declaration)
Public Class C1ZipEntryCollection
C#
public class C1ZipEntryCollection
Remarks
Use the C1ZipEntryCollection to programmatically manage the contents of zip files. You can
add, remove, extract, or insert items into the C1ZipEntryCollection.
Inheritance Hierarchy
System.Object
C1.C1Zip.C1ZipEntryCollection
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Members
C1.C1Zip Namespace
Members
For internal use only.
Syntax
Visual Basic (Declaration)
Public Shadows ReadOnly Property Items As
System.Windows.Forms.ListView.ListViewItemCollection
C#
public new System.Windows.Forms.ListView.ListViewItemCollection Items {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1PreviewThumbnailView Class
C1PreviewThumbnailView Members
Methods
%%scrap%%
" -->
For a list of all members of this type, see C1ZipEntryCollection members.
Public Methods
Name
Description
Add
AddFolder
Contains
Extract
ExtractFolder
IndexOf
Overloaded. Gets the index of the entry with the specified name.
OpenWriter
Overloaded. Opens a stream for writing an entry into the zip file.
Remove
Top
See Also
Reference
C1ZipEntryCollection Class
C1.C1Zip Namespace
Add Method
Adds an entry to the current zip file.
Overload List
Overload
Description
Add(String)
Add(String[])
Add(String,Int32)
Add(String,String)
Add(String,String,DateTime)
Add(Stream,String)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Add(String) Method
Name of the file to add to the zip file.
Adds an entry to the current zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Add( _
ByVal fileName As String _
)
C#
public void Add(
string fileName
)
Parameters
fileName
Name of the file to add to the zip file.
Remarks
By default, the directory name is not stored in the zip file. To store a specific part of the
directory name in the zip file, use the overloaded version of the Add method with a
pathLevels parameter.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Add(String[]) Method
Array containing the file names of the entries to be added to the zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Add( _
ByVal fileNames() As String _
)
C#
public void Add(
string[] fileNames
)
Parameters
fileNames
Array containing the file names of the entries to be added to the zip file.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Add(String,Int32) Method
Name of the file to add to the zip file.
The number of path levels to be stored as the entry name.
Adds an entry to the current zip file.
Syntax
Visual Basic (Declaration)
Parameters
fileName
Name of the file to add to the zip file.
pathLevels
The number of path levels to be stored as the entry name.
Remarks
By default, path names are not stored in the zip file. For example, adding the file
"c:\temp\samples\readme.txt" to the zip file will create an entry called "readme.txt".
The pathLevels parameter allows you to store one or more levels of the path in the
entry name. For example, adding the file "c:\temp\samples\readme.txt" to the zip file
with pathLevels=1 will create an entry called "samples\readme.txt".
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Add(String,String) Method
Name of the file to add to the zip file.
Name of the new entry as stored in the zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Add( _
ByVal fileName As String, _
ByVal entryName As String _
)
C#
public void Add(
string fileName,
string entryName
)
Parameters
fileName
Name of the file to add to the zip file.
entryName
Name of the new entry as stored in the zip file.
Remarks
By default, entries in the zip file have the same name as the original (uncompressed)
file. This method allows you to specify a different name, including a path for
example.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Add(String,String,DateTime) Method
Name of the file to add to the zip file.
Name of the new entry as stored in the zip file.
The date and time when the file was last modified.
Adds an entry to the current zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Add( _
ByVal fileName As String, _
ByVal entryName As String, _
ByVal dateTime As Date _
)
C#
public void Add(
string fileName,
string entryName,
DateTime dateTime
)
Parameters
fileName
Name of the file to add to the zip file.
entryName
Name of the new entry as stored in the zip file.
dateTime
The date and time when the file was last modified.
Remarks
By default, entries in the zip file have the same name as the original
(uncompressed) file. This method allows you to specify a different name,
including a path for example.
Requirements
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Add(Stream,String) Method
Stream that contains data for the new entry.
Name to be used for the new entry.
Adds a stream to the current zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Add( _
ByVal stream As Stream, _
ByVal entryName As String _
)
C#
public void Add(
Stream stream,
string entryName
)
Parameters
stream
Stream that contains data for the new entry.
entryName
Name to be used for the new entry.
Requirements
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Add(Stream,String,DateTime) Method
Stream that contains data for the new entry.
Name to be used for the new entry.
The date and time when the file was last modified.
Adds a stream to the current zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Add( _
ByVal stream As Stream, _
ByVal entryName As String, _
ByVal dateTime As Date _
)
C#
public void Add(
Stream stream,
string entryName,
DateTime dateTime
)
Parameters
stream
Stream that contains data for the new entry.
entryName
Name to be used for the new entry.
dateTime
The date and time when the file was last modified.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
AddFolder Method
Adds the content of a folder to the current zip file.
Overload List
Overload
Description
AddFolder(String)
AddFolder(String,String)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
AddFolder(String) Method
The full path of the folder to be added to the zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub AddFolder( _
ByVal path As String _
)
C#
public void AddFolder(
string path
)
Parameters
path
The full path of the folder to be added to the zip file.
Remarks
This method adds all files and sub folders to the zip file.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
AddFolder(String,String) Method
The full path of the folder to be added to the zip file.
A mask that specifies which files to add.
Adds the content of a folder to the current zip file.
Syntax
Parameters
path
The full path of the folder to be added to the zip file.
searchPattern
A mask that specifies which files to add.
Remarks
If the folder contains sub folders, those are also added to the zip file.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
AddFolder(String,String,Boolean) Method
The full path of the folder to be added to the zip file.
A mask that specifies which files to add.
True to include sub folders, false to include only files at the root level.
Syntax
Visual Basic (Declaration)
Public Overloads Sub AddFolder( _
ByVal path As String, _
ByVal searchPattern As String, _
ByVal includeSubfolders As Boolean _
)
C#
public void AddFolder(
string path,
string searchPattern,
bool includeSubfolders
)
Parameters
path
The full path of the folder to be added to the zip file.
searchPattern
A mask that specifies which files to add.
includeSubfolders
True to include sub folders, false to include only files at the root level.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Contains Method
Determines whether the collection contains an entry with a given name.
Overload List
Overload
Description
Contains(String)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Contains(String) Method
Name of the entry to look for.
Determines whether the collection contains an entry with a given name.
Syntax
Visual Basic (Declaration)
Public Overloads Function Contains( _
ByVal name As String _
) As Boolean
C#
public bool Contains(
string name
)
Parameters
name
Return Value
True if the collection contains an entry with the given name, false otherwise.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Contains(C1ZipEntry) Method
Entry of the entry to look for.
Determines whether the collection contains an entry.
Syntax
Visual Basic (Declaration)
Public Overloads Function Contains( _
ByVal entry As C1ZipEntry _
) As Boolean
C#
public bool Contains(
C1ZipEntry entry
)
Parameters
entry
Entry of the entry to look for.
Return Value
True if the collection contains the entry, false otherwise.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Extract Method
Extracts a file from the current zip file.
Overload List
Overload
Description
Extract(String)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Extract(Int32,String) Method
Index of the entry to extract.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Extract( _
ByVal index As Integer, _
ByVal destFileName As String _
)
C#
public void Extract(
int index,
string destFileName
)
Parameters
index
Index of the entry to extract.
destFileName
Name and location of the extracted file.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Extract(String,String) Method
Name of the entry to extract.
Name and location of the extracted file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Extract( _
ByVal entryName As String, _
ByVal destFileName As String _
)
C#
public void Extract(
string entryName,
string destFileName
)
Parameters
entryName
Name of the entry to extract.
destFileName
Name and location of the extracted file.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Extract(Int32) Method
The toolstrip to attach to.
Attaches the tools integrator to the specified toolstrip. If the toolstrip contains preview items,
they will be handled by the tools integrator.
Syntax
Visual Basic (Declaration)
Public Sub AttachToolStrip( _
ByVal toolstrip As System.Windows.Forms.ToolStrip _
)
C#
public void AttachToolStrip(
System.Windows.Forms.ToolStrip toolstrip
)
Parameters
toolstrip
The toolstrip to attach to.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1PreviewToolsIntegrator Class
C1PreviewToolsIntegrator Members
Extract(String) Method
Name of the entry to extract.
Extracts a file from the current zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Extract( _
ByVal entryName As String _
)
C#
Parameters
entryName
Name of the entry to extract.
Remarks
The entry is extracted to a file in the same folder as the current zip file, with the same
name as the entry.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
ExtractFolder Method
Destination path for the unzipped files.
Extracts the contents of the zip file into a specified path.
Syntax
Visual Basic (Declaration)
Public Sub ExtractFolder( _
ByVal path As String _
)
C#
public void ExtractFolder(
string path
)
Parameters
path
Destination path for the unzipped files.
Remarks
If the zip file contains compressed folders, new folders will be created under the
destination path to preserve the hierarchical structure of the archive.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
IndexOf Method
Gets the index of the entry with the specified name.
Overload List
Overload
Description
IndexOf(String)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
IndexOf(String) Method
Name of the entry to look for.
Gets the index of the entry with the specified name.
Syntax
Visual Basic (Declaration)
Public Overloads Function IndexOf( _
ByVal name As String _
) As Integer
C#
public int IndexOf(
string name
)
Parameters
name
Name of the entry to look for.
Return Value
The index of the entry in the collection, or -1 if the entry was not found.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
IndexOf(C1ZipEntry) Method
C1ZipEntry to look for.
Syntax
Visual Basic (Declaration)
Public Overloads Function IndexOf( _
ByVal entry As C1ZipEntry _
) As Integer
C#
public int IndexOf(
C1ZipEntry entry
)
Parameters
entry
C1ZipEntry to look for.
Return Value
The index of the entry in the collection, or -1 if the entry was not found.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
OpenWriter Method
For internal use.
Overload List
Overload
Description
FileSave()
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1PreviewToolsIntegrator Class
C1PreviewToolsIntegrator Members
OpenWriter(String,Boolean) Method
The name of the new entry.
Whether to use a memory stream or temporary file.
Opens a stream for writing an entry into the zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Function OpenWriter( _
ByVal entryName As String, _
ByVal useMemory As Boolean _
) As Stream
C#
public Stream OpenWriter(
string entryName,
bool useMemory
)
Parameters
entryName
The name of the new entry.
useMemory
Return Value
A stream that can be used to write data into the zip file. The entry is not added until
the stream is closed.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
OpenWriter(String,DateTime,Boolean) Method
The name of the new entry.
The date and time when the file was last modified.
Whether to use a memory stream or temporary file.
Opens a stream for writing an entry into the zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Function OpenWriter( _
ByVal entryName As String, _
ByVal dateTime As Date, _
ByVal useMemory As Boolean _
) As Stream
C#
public Stream OpenWriter(
string entryName,
DateTime dateTime,
bool useMemory
)
Parameters
entryName
The name of the new entry.
dateTime
The date and time when the file was last modified.
useMemory
Whether to use a memory stream or temporary file.
Return Value
A stream that can be used to write data into the zip file. The entry is not added
until the stream is closed.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Remove Method
Removes an entry from the current zip file.
Overload List
Overload
Description
Remove(Int32)
Remove(String)
Remove(Int32[])
Remove(String[])
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Remove(Int32) Method
Index of the entry to remove.
Removes an entry from the current zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Remove( _
ByVal index As Integer _
)
C#
public void Remove(
int index
)
Parameters
index
Index of the entry to remove.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Remove(String) Method
Name of the entry to remove (case-insensitive).
Removes an entry from the current zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Remove( _
ByVal fileName As String _
)
C#
public void Remove(
string fileName
)
Parameters
fileName
Name of the entry to remove (case-insensitive).
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Remove(Int32[]) Method
Array containing the indices of the entries to remove.
Removes several entries from the current zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Remove( _
ByVal indices() As Integer _
)
C#
public void Remove(
int[] indices
)
Parameters
indices
Array containing the indices of the entries to remove.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Remove(String[]) Method
Array containing the names of the entries to remove.
Removes several entries from the current zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Remove( _
ByVal entryNames() As String _
)
C#
public void Remove(
string[] entryNames
)
Parameters
entryNames
Array containing the names of the entries to remove.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Properties
>
Name
Description
Count
Item
Top
See Also
Reference
C1ZipEntryCollection Class
C1.C1Zip Namespace
Count Property
Gets the number of entries in the current zip file.
Syntax
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Item Property
Gets the C1ZipEntry at the specified index.
Overload List
Overload
Description
Item(Int32)
Item(String)
Gets the C1ZipEntry with the given name (returns null if the entry cannot be
found).
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Item(Int32) Property
Gets the C1ZipEntry at the specified index.
Syntax
Visual Basic (Declaration)
Public Overloads ReadOnly Property Item( _
ByVal index As Integer _
) As C1ZipEntry
C#
public C1ZipEntry Item(
int index
) {get;}
Parameters
index
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
Item(String) Property
Gets the C1ZipEntry with the given name (returns null if the entry cannot be found).
Syntax
Visual Basic (Declaration)
Public Overloads ReadOnly Property Item( _
ByVal name As String _
) As C1ZipEntry
C#
public C1ZipEntry Item(
string name
) {get;}
Parameters
name
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipEntryCollection Class
C1ZipEntryCollection Members
Overload List
C1ZipFile
Example
Object Model
Syntax
Visual Basic (Declaration)
Public Class C1ZipFile
C#
public class C1ZipFile
Remarks
Use the Open(String) or Create(String) methods to associate the C1Zip file object with a zip file
on disk. Then use the Entries property to add, remove, retrieve, or inspect individual entries in
the zip file.
C1ZipFile can only be used with standard zip files. The component does not support other
similar formats such as gzip, zip2, tar, or rar.
The standard zip file imposes some limitations on the size of each entry. You cannot use it to
compress files larger than 4 gigabytes (uint.MaxValue).
Example
The code below creates a zip file called sources.zip and adds all files with a "cs" extension to
the zip file:
C#
Inheritance Hierarchy
System.Object
C1.C1Zip.C1ZipFile
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Members
C1.C1Zip Namespace
Overview
Example
Object Model
Syntax
Visual Basic (Declaration)
Public Class C1ZipFile
C#
public class C1ZipFile
Remarks
Use the Open(String) or Create(String) methods to associate the C1Zip file object with a zip file
on disk. Then use the Entries property to add, remove, retrieve, or inspect individual entries in
the zip file.
C1ZipFile can only be used with standard zip files. The component does not support other
similar formats such as gzip, zip2, tar, or rar.
The standard zip file imposes some limitations on the size of each entry. You cannot use it to
compress files larger than 4 gigabytes (uint.MaxValue).
Example
The code below creates a zip file called sources.zip and adds all files with a "cs" extension to
the zip file:
C#
Inheritance Hierarchy
System.Object
C1.C1Zip.C1ZipFile
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Members
C1.C1Zip Namespace
Members
Properties Methods Events
Public Constructors
Name
Description
Public Properties
Name
Description
Comment
CompressionLevel
Gets or sets the compression level to use when adding entries to the
zip file.
Entries
FileName
MemoryThreshold
OverwriteHidden
Password
TempFileName
Gets or sets the name of the temporary file to use when adding entries
to the zip file.
UseUtf8Encoding
Top
Public Methods
Name
Description
Close
CloseBatch
Closes a zip file after it was opened with a call to the OpenBatch
method.
Create
IsZipFile
Open
OpenBatch
Refresh
Top
Public Events
Name
Description
Progress
Fired while data is being read from or written into a zip file.
Top
See Also
Reference
C1ZipFile Class
C1.C1Zip Namespace
C1ZipFile Constructor
Overload List
Overload
Description
C1ZipFile Constructor()
C1ZipFile Constructor(String,Boolean)
C1ZipFile Constructor(String)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
C1ZipFile Constructor()
Initializes a new instance of the C1ZipFile class.
Syntax
Visual Basic (Declaration)
Public Function New()
C#
public C1ZipFile()
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
C1ZipFile Constructor(String,Boolean)
The name of the zip file to open or create.
True to create a new zip file, false to open an existing file.
Initializes a new instance of the C1ZipFile class and creates or opens a zip file associated with
this new instance.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal fileName As String, _
ByVal create As Boolean _
)
C#
public C1ZipFile(
string fileName,
bool create
)
Parameters
fileName
The name of the zip file to open or create.
create
True to create a new zip file, false to open an existing file.
Remarks
If create is true and the zip file already exists, it is overwritten with a new empty file.
If create is false and the zip file already exists, the existing file is opened.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
C1ZipFile Constructor(String)
The name of the zip file to open.
Initializes a new instance of the C1ZipFile class and opens a zip file associated with this new
instance.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal fileName As String _
)
C#
public C1ZipFile(
string fileName
)
Parameters
fileName
The name of the zip file to open.
Remarks
If the file does not exist, a new empty file is created.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
C1ZipFile Constructor(Stream,Boolean)
System.IO.Stream that contains the zip data.
Whether to initialize the stream with an empty zip header or open an existing zip file in the
stream.
Initializes a new instance of the C1ZipFile class and opens a zip stream associated with this new
instance.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal stream As Stream, _
ByVal create As Boolean _
)
C#
public C1ZipFile(
Stream stream,
bool create
)
Parameters
stream
System.IO.Stream that contains the zip data.
create
Whether to initialize the stream with an empty zip header or open an existing zip file in
the stream.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
C1ZipFile Constructor(Stream)
System.IO.Stream that contains the zip data.
Initializes a new instance of the C1ZipFile class and opens a zip stream associated with this new
instance.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal stream As Stream _
)
C#
public C1ZipFile(
Stream stream
)
Parameters
stream
System.IO.Stream that contains the zip data.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
Methods
%%scrap%%
" -->
For a list of all members of this type, see C1ZipFile members.
Public Methods
Name
Description
Close
CloseBatch
Closes a zip file after it was opened with a call to the OpenBatch
method.
Create
IsZipFile
Open
OpenBatch
Refresh
Top
See Also
Reference
C1ZipFile Class
C1.C1Zip Namespace
Close Method
Resets all data members of the C1ZipFile object.
Syntax
Visual Basic (Declaration)
Public Sub Close()
C#
public void Close()
Remarks
Disk files are automatically closed by C1Zip. You only need to use this method if you want to
break the connection between a C1ZipFile class and a physical zip file.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
CloseBatch Method
Closes a zip file after it was opened with a call to the OpenBatch method.
Syntax
Visual Basic (Declaration)
Public Sub CloseBatch()
C#
public void CloseBatch()
Remarks
See the OpenBatch method for a complete description and a sample.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Create Method
Creates an empty zip file on disk.
Overload List
Overload
Description
Create(String)
Create(Stream)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Create(String) Method
The name of the zip file to create, including the path.
Creates an empty zip file on disk.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Create( _
ByVal fileName As String _
)
C#
public void Create(
string fileName
)
Parameters
fileName
Remarks
If a file by the same name already exists, it is deleted before the new one is created.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
Create(Stream) Method
Example
Syntax
Visual Basic (Declaration)
Public Overloads Sub Create( _
ByVal stream As Stream _
)
C#
public void Create(
Stream stream
)
Parameters
stream
System.IO.Stream that will contain the new zip file.
Example
The code below creates a new C1ZipFile on a memory stream, then adds several files to it.
Finally, the code gets the zipped data out as an array of bytes, which could be stored in a
database for example.
C#
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
IsZipFile Method
Tests whether a file is a valid zip file.
Overload List
Overload
Description
IsZipFile(String)
IsZipFile(Stream)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
IsZipFile(String) Method
Name of the file to test.
Tests whether a file is a valid zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Shared Function IsZipFile( _
ByVal fileName As String _
) As Boolean
C#
public static bool IsZipFile(
string fileName
)
Parameters
fileName
Name of the file to test.
Return Value
True if the file exists and is a valid zip file, false otherwise.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
IsZipFile(Stream) Method
System.IO.Stream to test.
Tests whether a stream contains a valid zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Shared Function IsZipFile( _
ByVal stream As Stream _
) As Boolean
C#
public static bool IsZipFile(
Stream stream
)
Parameters
stream
System.IO.Stream to test.
Return Value
True if stream contains a valid zip file, false otherwise.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
Open Method
Opens an existing zip file.
Overload List
Overload
Description
Open(String)
Open(Stream)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Open(String) Method
The name of an existing zip file, including the path.
Opens an existing zip file.
Syntax
Visual Basic (Declaration)
Public Overloads Sub Open( _
ByVal fileName As String _
)
C#
public void Open(
string fileName
)
Parameters
fileName
The name of an existing zip file, including the path.
Remarks
This method checks that the zip file exists and is a valid zip file, then reads the zip file
directory into the Entries collection. The zip file is then closed, and can be used by other
applications. There is no need to close the zip file explicitly.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
Open(Stream) Method
Example
Syntax
Visual Basic (Declaration)
Public Overloads Sub Open( _
ByVal stream As Stream _
)
C#
public void Open(
Stream stream
)
Parameters
stream
System.IO.Stream that contains a zip file.
Remarks
This method allows you to open and work with a zip file stored in a stream instead of in an
actual file.
Typical usage scenarios for this are zip files stored as application resources or in binary
database fields.
Example
The example below loads information from a zip file stored in an embedded resource. To
embed a zip file in an application, follow these steps:
1) Right-click the project node in Visual Studio, select the Add | Add Existing Item...
menu option.
2) Select a zip file to add to the project as an embedded resource.
3) Select the newly added file and make sure the Build Action property is set to
"Embedded Resource".
C#
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Overload List
OpenBatch Method
Example
Syntax
Visual Basic (Declaration)
Public Sub OpenBatch()
C#
public void OpenBatch()
Remarks
By default, C1ZipFile opens and closes the zip file automatically whenever entries are added or
removed.
This can cause delays in systems that have certain types of anti-virus software installed, or in
situations where you want to add a large number of relatively small entries. In these cases, use
the OpenBatch and CloseBatch methods to keep the zip file open until the entire operation is
concluded.
Use a finally clause to ensure that the CloseBatch method is called even if an exception occurs.
Example
The code below opens a zip file, adds several entries to it, then closes the file:
C#
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Refresh Method
Refreshes all data members by re-opening the current zip file.
Syntax
Visual Basic (Declaration)
Public Sub Refresh()
C#
public void Refresh()
Remarks
This method is useful in instances where other applications may have changed the zip file and
you want to make sure the information in the Entries collection is up to date.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Properties
%%scrap%%
" -->
For a list of all members of this type, see C1ZipFile members.
Public Properties
Name
Description
Comment
CompressionLevel
Gets or sets the compression level to use when adding entries to the
zip file.
Entries
FileName
MemoryThreshold
OverwriteHidden
Password
TempFileName
Gets or sets the name of the temporary file to use when adding entries
to the zip file.
UseUtf8Encoding
Top
See Also
Reference
C1ZipFile Class
C1.C1Zip Namespace
Comment Property
Gets or sets a comment associated with the current zip file.
Syntax
Visual Basic (Declaration)
Public Property Comment As String
C#
public string Comment {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
CompressionLevel Property
Gets or sets the compression level to use when adding entries to the zip file.
Syntax
Visual Basic (Declaration)
Public Property CompressionLevel As CompressionLevelEnum
C#
public CompressionLevelEnum CompressionLevel {get; set;}
Remarks
Higher compression settings create smaller files, but take longer to process. The default setting
(CompressionLevelEnum.DefaultCompression) provides a good trade-off between compression
and speed.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Entries Property
Gets a C1ZipEntryCollection that contains the entries in the zip file.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property Entries As C1ZipEntryCollection
C#
public C1ZipEntryCollection Entries {get;}
Remarks
The Entries collection is used to enumerate the entries in the zip file, and also to add, remove,
and expand entries.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
FileName Property
Gets the name of the current zip file.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property FileName As String
C#
public string FileName {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
MemoryThreshold Property
Gets or sets the size of the largest stream to be compressed in memory.
Syntax
Visual Basic (Declaration)
Public Property MemoryThreshold As Integer
C#
public int MemoryThreshold {get; set;}
Remarks
C1ZipFile compresses entries into temporary streams before adding them to the zip file.
Entries with fewer than MemoryThreshold bytes are compressed using a temporary memory
stream.
Entries with more than MemoryThreshold bytes are compressed using a temporary file. You can
control the location of the temporary file using the TempFileName property.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
OverwriteHidden Property
Determines whether the component should overwrite hidden files when extracting entries from
the zip file.
Syntax
Visual Basic (Declaration)
Public Property OverwriteHidden As Boolean
C#
public bool OverwriteHidden {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
OverwriteReadOnly Property
Determines whether the component should overwrite read-only files when extracting entries
from the zip file.
Syntax
Visual Basic (Declaration)
Public Property OverwriteReadOnly As Boolean
C#
public bool OverwriteReadOnly {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
OverwriteSystem Property
Determines whether the component should overwrite system files when extracting entries from
the zip file.
Syntax
Visual Basic (Declaration)
Public Property OverwriteSystem As Boolean
C#
public bool OverwriteSystem {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Password Property
Properties Methods Events
Public Constructors
Name
Description
Public Properties
Name
Description
AccessibilityObject
AccessibleName
AccessibleRole
ActiveControl
(Inherited from
System.Windows.Forms.ContainerControl)
AllowDrop
Anchor
AutoScaleDimensions
(Inherited from
System.Windows.Forms.ContainerControl)
AutoScaleMode
(Inherited from
System.Windows.Forms.ContainerControl)
AutoScrollOffset
AutoScrollPosition
(Inherited from
System.Windows.Forms.ScrollableControl)
AvailablePreviewActions
BindingContext
(Inherited from
System.Windows.Forms.ContainerControl)
Bottom
BottomToolStripPanel
BottomToolStripPanelVisible
Bounds
CanFocus
CanSelect
Capture
ClientRectangle
ClientSize
CompanyName
Container
ContainsFocus
ContentPanel
ContextMenu
Created
CurrentAutoScaleDimensions
(Inherited from
System.Windows.Forms.ContainerControl)
DataBindings
DisplayRectangle
(Inherited from
System.Windows.Forms.ScrollableControl)
Disposing
Dock
Document
Enabled
ExportOptions
Focused
Font
Handle
HasChildren
Height
HorizontalScroll
(Inherited from
System.Windows.Forms.ScrollableControl)
ImageSet
ImeMode
InvokeRequired
IsAccessible
IsDisposed
IsHandleCreated
IsMirrored
LayoutEngine
Left
LeftToolStripPanel
LeftToolStripPanelVisible
Location
Margin
MaximumSize
MinimumSize
Name
NavigationPanelVisible
OutlineViewCaption
Padding
Parent
ParentForm
(Inherited from
System.Windows.Forms.ContainerControl)
PreferredSize
PreviewNavigationPanel
PreviewOutlineView
PreviewPane
PreviewProgressBar
PreviewStatusBar
PreviewStatusText
PreviewTextSearchPanel
PreviewThumbnailView
ProductName
ProductVersion
RecreatingHandle
Region
Right
RightToLeft
RightToolStripPanel
RightToolStripPanelVisible
Site
Size
SsrsPaginated
StatusBarVisible
TabIndex
TabStop
Tag
Text
TextSearchPanelVisible
TextSearchUIStyle
ThumbnailViewCaption
ToolBars
Top
TopLevelControl
TopToolStripPanel
TopToolStripPanelVisible
UseWaitCursor
VerticalScroll
(Inherited from
System.Windows.Forms.ScrollableControl)
Visible
Width
Top
Public Methods
Name
Description
BeginInvoke
BringToFront
Contains
CreateControl
CreateGraphics
CreateObjRef
Dispose
DoDragDrop
DrawToBitmap
EndInvoke
FindForm
Focus
GetChildAtPoint
GetContainerControl
GetLifetimeService
GetNextControl
GetPreferredSize
Hide
InitializeLifetimeService
Invalidate
Invoke
PerformAutoScale
PerformLayout
PointToClient
PointToScreen
RectangleToClient
RectangleToScreen
Refresh
ResetText
ResumeLayout
Scale
ScrollControlIntoView
Select
SelectNextControl
SendToBack
SetAutoScrollMargin
SetBounds
Show
SuspendLayout
ToString
Update
Validate
Top
Public Events
Name
Description
Click
ClientSizeChanged
ContextMenuChanged
ControlAdded
ControlRemoved
Disposed
DockChanged
DoubleClick
DragDrop
DragEnter
DragLeave
DragOver
EnabledChanged
Enter
FontChanged
GiveFeedback
GotFocus
HandleCreated
HandleDestroyed
HelpRequested
ImeModeChanged
Invalidated
KeyDown
KeyPress
KeyUp
Layout
Leave
LocationChanged
LostFocus
MarginChanged
MouseDoubleClick
MouseDown
MouseEnter
MouseHover
MouseLeave
MouseMove
MouseUp
MouseWheel
Move
PaddingChanged
Paint
ParentChanged
PreviewKeyDown
QueryAccessibilityHelp
QueryContinueDrag
RegionChanged
Resize
RightToLeftChanged
Scroll
SizeChanged
StyleChanged
SystemColorsChanged
TabIndexChanged
TabStopChanged
TextChanged
Validated
Validating
VisibleChanged
Top
See Also
Reference
C1PrintPreviewControl Class
C1.Win.C1Preview Namespace
TempFileName Property
Gets or sets the name of the temporary file to use when adding entries to the zip file.
Syntax
Visual Basic (Declaration)
Public Property TempFileName As String
C#
public string TempFileName {get; set;}
Remarks
C1ZipFile creates temporary streams while adding entries to a zip file. These temporary streams
can be memory-based or disk-based, depending on the size of the entry and on the setting of
the MemoryThreshold property.
If a temporary file is used, C1ZipFile you can control its location by setting the TempFileName
property. If you don't select a path for the temporary file, C1ZipFile will create one automatically
using the System.IO.Path.GetTempFileName method.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
UseUtf8Encoding Property
Determines whether file names and comments should be stored in UTF8 format.
Syntax
Visual Basic (Declaration)
Public Property UseUtf8Encoding As Boolean
C#
public bool UseUtf8Encoding {get; set;}
Remarks
The Zip specification does not specify what character encoding to be used for the embedded
file names and comments. The original IBM PC character encoding set, commonly referred to as
IBM Code Page 437, is supposed to be the only encoding supported. Because of this, some zip
utilities will not allow storing file names or comments with Unicode characters. Others do allow
it, but those file names and comments may not be read correctly by other utilities.
Setting the UseUtf8Encoding to true causes C1Zip to store and retrieve file names and
comments using the Utf8 encoding, which allows Unicode characters. The caveat is that
Unicode file names may not be read correctly by other zip utilities.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZipFile Class
C1ZipFile Members
Events
%%scrap%%
" -->
For a list of all members of this type, see C1ZipFile members.
Public Events
Name
Description
Progress
Fired while data is being read from or written into a zip file.
Top
See Also
Reference
C1ZipFile Class
C1.C1Zip Namespace
Progress Event
For internal use.
Syntax
Visual Basic (Declaration)
Public Shadows Property BottomToolStripPanelVisible As System.Boolean
C#
public new System.bool BottomToolStripPanelVisible {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1PrintPreviewControl Class
C1PrintPreviewControl Members
C1ZStreamReader
Example
Object Model
Syntax
Visual Basic (Declaration)
Public Class C1ZStreamReader
Inherits System.IO.Stream
C#
Remarks
To decompress data from a compressed stream, create a C1ZStreamReader object passing the
compressed stream to the C1ZStreamReader constructor.
Then read the data from the C1ZStreamReader using the Read method, or create a
System.IO.StreamReader on the C1ZStreamReader. The second option is indicated when you
want to read formatted data.
Example
The code below decompresses a string that was stored into a memory stream object:
C#
Inheritance Hierarchy
System.Object
System.MarshalByRefObject
System.IO.Stream
C1.C1Zip.C1ZStreamReader
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Members
C1.C1Zip Namespace
Overview
Example
Object Model
Syntax
Visual Basic (Declaration)
Public Class C1ZStreamReader
Inherits System.IO.Stream
C#
public class C1ZStreamReader : System.IO.Stream
Remarks
To decompress data from a compressed stream, create a C1ZStreamReader object passing the
compressed stream to the C1ZStreamReader constructor.
Then read the data from the C1ZStreamReader using the Read method, or create a
System.IO.StreamReader on the C1ZStreamReader. The second option is indicated when you
want to read formatted data.
Example
The code below decompresses a string that was stored into a memory stream object:
C#
Inheritance Hierarchy
System.Object
System.MarshalByRefObject
System.IO.Stream
C1.C1Zip.C1ZStreamReader
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Members
C1.C1Zip Namespace
Members
Properties Methods
Public Constructors
Name
Description
Public Properties
Name
Description
BaseStream
CanRead
CanSeek
CanTimeout
CanWrite
Length
OwnsBaseStream
Gets or sets whether calling the Close method will also close the
underlying stream (see BaseStream).
Position
ReadTimeout
SizeCompressed
SizeCompressedLong
SizeUncompressed
Gets the number of bytes that were compressed into the stream
(uncompressed bytes).
SizeUncompressedLong Gets the number of bytes that were compressed into the stream
(uncompressed bytes).
WriteTimeout
ZStream
Top
Public Methods
Name
Description
BeginRead
BeginWrite
Close
Overridden.
Closes the current stream compressor and flushed any pending
CopyTo
CopyToAsync
CreateObjRef
Dispose
EndRead
EndWrite
Flush
Overridden. Clears all buffers for this stream and causes any
buffered data to be written to the underlying stream.
FlushAsync
GetLifetimeService
ReadAsync
ReadByte
of the stream.
Seek
SetLength
Write
WriteAsync
WriteByte
Top
See Also
Reference
C1ZStreamReader Class
C1.C1Zip Namespace
C1ZStreamReader Constructor
Overload List
Overload
Description
C1ZStreamReader Constructor(Stream)
C1ZStreamReader Constructor(Stream,Boolean,Int32)
C1ZStreamReader Constructor(Stream,Boolean)
C1ZStreamReader Constructor(Stream,Boolean,Boolean)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
C1ZStreamReader Constructor(Stream)
Input stream that contains the compressed data.
Initializes a new instance of the C1ZStreamReader class.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal baseStream As Stream _
)
C#
public C1ZStreamReader(
Stream baseStream
)
Parameters
baseStream
Input stream that contains the compressed data.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Overload List
C1ZStreamReader Constructor(Stream,Boolean,Int32)
Input stream that contains the compressed data.
Specifies whether the compressed stream was created in zip format.
Specifies the number of compressed bytes to read from the stream.
Initializes a new instance of the C1ZStreamReader class.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal baseStream As Stream, _
ByVal zip As Boolean, _
ByVal sizeCompressed As Integer _
)
C#
public C1ZStreamReader(
Stream baseStream,
bool zip,
int sizeCompressed
)
Parameters
baseStream
Input stream that contains the compressed data.
zip
Specifies whether the compressed stream was created in zip format.
sizeCompressed
Specifies the number of compressed bytes to read from the stream.
Remarks
The sizeCompressed parameter is needed only when a single stream contains
several compressed streams (in zip files for example). If this parameter is not
specified, it is assumed that the stream contains a single stream of compressed
data.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Overload List
C1ZStreamReader Constructor(Stream,Boolean)
Input stream that contains the compressed data.
Specifies whether the compressed stream was created in zip format.
Initializes a new instance of the C1ZStreamReader class.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal baseStream As Stream, _
ByVal zip As Boolean _
)
C#
public C1ZStreamReader(
Stream baseStream,
bool zip
)
Parameters
baseStream
Input stream that contains the compressed data.
zip
Specifies whether the compressed stream was created in zip format.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Overload List
C1ZStreamReader Constructor(Stream,Boolean,Boolean)
Input stream that contains the compressed data.
Specifies whether the compressed stream contains header information (should be False for
streams in zip files).
Specifies whether the compressed stream contains a CRC32 checksum (should be True for
streams in zip files).
Initializes a new instance of the C1ZStreamReader class.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal baseStream As Stream, _
ByVal header As Boolean, _
ByVal crc32 As Boolean _
)
C#
public C1ZStreamReader(
Stream baseStream,
bool header,
bool crc32
)
Parameters
baseStream
Input stream that contains the compressed data.
header
Specifies whether the compressed stream contains header information (should be False
for streams in zip files).
crc32
Specifies whether the compressed stream contains a CRC32 checksum (should be True
for streams in zip files).
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Overload List
C1ZStreamReader Constructor(Stream,Boolean,Int32,Int32)
Input stream that contains the compressed data.
Specifies whether the compressed stream was created in zip format.
Specifies the number of compressed bytes to read from the stream.
Specifies the method that was used to compress the stream.
Initializes a new instance of the C1ZStreamReader class.
Syntax
Visual Basic (Declaration)
Parameters
baseStream
Input stream that contains the compressed data.
zip
Specifies whether the compressed stream was created in zip format.
sizeCompressed
Specifies the number of compressed bytes to read from the stream.
method
Specifies the method that was used to compress the stream.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP
SP3, Windows Server 2008 (Server Core not supported), Windows Server
2008 R2 (Server Core supported with SP1 or later), Windows Server 2003
SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Overload List
C1ZStreamReader Constructor(Stream,Boolean,Int64,Int32)
Input stream that contains the compressed data.
Specifies whether the compressed stream was created in zip format.
Specifies the number of compressed bytes to read from the stream.
Specifies the method that was used to compress the stream.
Initializes a new instance of the C1ZStreamReader class.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal baseStream As Stream, _
ByVal zip As Boolean, _
ByVal sizeCompressed As Long, _
ByVal method As Integer _
)
C#
public C1ZStreamReader(
Stream baseStream,
bool zip,
long sizeCompressed,
int method
)
Parameters
baseStream
Input stream that contains the compressed data.
zip
Specifies whether the compressed stream was created in zip format.
sizeCompressed
Specifies the number of compressed bytes to read from the stream.
method
Specifies the method that was used to compress the stream.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP
SP3, Windows Server 2008 (Server Core not supported), Windows Server
2008 R2 (Server Core supported with SP1 or later), Windows Server 2003
SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Overload List
Methods
>
Name
Description
BeginRead
BeginWrite
Close
CopyTo
CopyToAsync
CreateObjRef
Dispose
EndRead
EndWrite
Flush
Overridden. Clears all buffers for this stream and causes any
buffered data to be written to the underlying stream.
FlushAsync
GetLifetimeService
ReadAsync
ReadByte
Seek
SetLength
Write
WriteAsync
WriteByte
Top
See Also
Reference
C1ZStreamReader Class
C1.C1Zip Namespace
Close Method
Closes the current stream compressor and flushed any pending data into the base stream.
If the OwnsBaseStream property is set to True (the default value), then this method also closes
the base stream and releases any resources (such as sockets and file handles) associated with it.
Syntax
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Flush Method
Clears all buffers for this stream and causes any buffered data to be written to the underlying
stream.
Syntax
Visual Basic (Declaration)
Public Overrides Sub Flush()
C#
public override void Flush()
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Read Method
An array of bytes. When this method returns, buf contains the specified byte array with the
values between offsetand (offset + count) replaced by the uncompressed data read from the
stream.
The zero-based byte offset in buf at which to begin storing the data read from the current
stream.
The maximum number of (decompressed) bytes to be read from the current stream.
Reads a sequence of bytes from the underlying compressed stream, decompressing them into a
buffer, then advances the position within the stream by the number of bytes read.
Syntax
Visual Basic (Declaration)
Public Overrides Function Read( _
ByVal buf() As Byte, _
ByVal offset As Integer, _
ByVal count As Integer _
) As Integer
C#
public override int Read(
byte[] buf,
int offset,
int count
)
Parameters
buf
An array of bytes. When this method returns, buf contains the specified byte array with
the values between offsetand (offset + count) replaced by the uncompressed data read
from the stream.
offset
The zero-based byte offset in buf at which to begin storing the data read from the
current stream.
count
The maximum number of (decompressed) bytes to be read from the current stream.
Return Value
The total number of bytes read into the buffer. This may be less than the
number of bytes requested if that many bytes are not currently available, or
zero (0) if the end of the stream has been reached.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
ReadByte Method
Reads a byte from the stream and advances the position within the stream by one byte, or
returns -1 if at the end of the stream.
Syntax
Visual Basic (Declaration)
Public Overrides Function ReadByte() As Integer
C#
public override int ReadByte()
Return Value
The unsigned byte cast to an System.Int32, or -1 if at the end of the stream.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Seek Method
Not supported.
Syntax
Visual Basic (Declaration)
Public Overrides Function Seek( _
ByVal offset As Long, _
ByVal origin As SeekOrigin _
) As Long
C#
public override long Seek(
long offset,
SeekOrigin origin
)
Parameters
offset
origin
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
SetLength Method
Sets the number of compressed bytes to read from the underlying stream.
Syntax
Visual Basic (Declaration)
Public Overrides Sub SetLength( _
Parameters
value
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Write Method
This method is overridden and is not supported by the C1ZStreamReader class.
Syntax
Visual Basic (Declaration)
Public Overrides Sub Write( _
ByVal buf() As Byte, _
ByVal offset As Integer, _
ByVal count As Integer _
)
C#
public override void Write(
byte[] buf,
int offset,
int count
)
Parameters
buf
offset
count
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Properties
%%scrap%%
" -->
For a list of all members of this type, see C1ZStreamReader members.
Public Properties
Name
Description
BaseStream
CanRead
CanSeek
CanTimeout
CanWrite
Length
unknown).
OwnsBaseStream
Gets or sets whether calling the Close method will also close the
underlying stream (see BaseStream).
Position
ReadTimeout
SizeCompressed
SizeCompressedLong
SizeUncompressed
Gets the number of bytes that were compressed into the stream
(uncompressed bytes).
SizeUncompressedLong Gets the number of bytes that were compressed into the stream
(uncompressed bytes).
WriteTimeout
ZStream
Top
See Also
Reference
C1ZStreamReader Class
C1.C1Zip Namespace
BaseStream Property
Gets the underlying stream that contains the compressed data.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property BaseStream As Stream
C#
public Stream BaseStream {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
CanRead Property
Always returns True.
Syntax
Visual Basic (Declaration)
Public Overrides ReadOnly Property CanRead As Boolean
C#
public override bool CanRead {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
CanSeek Property
Always returns False.
Syntax
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
CanWrite Property
Always returns False.
Syntax
Visual Basic (Declaration)
Public Overrides ReadOnly Property CanWrite As Boolean
C#
public override bool CanWrite {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Length Property
Gets the length of the compressed stream if it is known (or -1 if the length of the compressed
stream is unknown).
Syntax
Visual Basic (Declaration)
Public Overrides ReadOnly Property Length As Long
C#
public override long Length {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
OwnsBaseStream Property
Gets or sets whether calling the Close method will also close the underlying stream (see
BaseStream).
Syntax
Visual Basic (Declaration)
Public Property OwnsBaseStream As Boolean
C#
public bool OwnsBaseStream {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
Position Property
Gets the position within the stream (read-only).
Syntax
Visual Basic (Declaration)
Public Overrides Property Position As Long
C#
public override long Position {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
SizeCompressed Property
Gets the number of bytes in the stream (compressed bytes).
Syntax
Visual Basic (Declaration)
Public ReadOnly Property SizeCompressed As Integer
C#
public int SizeCompressed {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
SizeCompressedLong Property
Gets the number of bytes in the stream (compressed bytes).
Syntax
Visual Basic (Declaration)
Public ReadOnly Property SizeCompressedLong As Long
C#
public long SizeCompressedLong {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
SizeUncompressed Property
Gets the number of bytes that were compressed into the stream (uncompressed bytes).
Syntax
Visual Basic (Declaration)
Public ReadOnly Property SizeUncompressed As Integer
C#
public int SizeUncompressed {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
SizeUncompressedLong Property
Gets the number of bytes that were compressed into the stream (uncompressed bytes).
Syntax
Visual Basic (Declaration)
Public ReadOnly Property SizeUncompressedLong As Long
C#
public long SizeUncompressedLong {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
ZStream Property
Gets the ZStream instance wrapped by this C1ZStreamWriter.
Syntax
Remarks
This property is useful only in advanced applications that need to customize the low-level
behavior of the compressor. It is not needed in common applications.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamReader Class
C1ZStreamReader Members
C1ZStreamWriter
Example
Object Model
Syntax
Visual Basic (Declaration)
Public Class C1ZStreamWriter
Inherits System.IO.Stream
C#
public class C1ZStreamWriter : System.IO.Stream
Remarks
To compress data into a stream, create a C1ZStreamWriter object passing the stream to the
C1ZStreamWriter constructor.
Then write the data into the C1ZStreamWriter using the Write method, or create a
System.IO.StreamWriter on the C1ZStreamWriter. The second option is indicated when you
want to write formatted data.
When you are done writing the data, call the Close method to flush the data and close the
underlying stream.
Example
The code below compresses a string into a memory stream:
C#
Inheritance Hierarchy
System.Object
System.MarshalByRefObject
System.IO.Stream
C1.C1Zip.C1ZStreamWriter
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Members
C1.C1Zip Namespace
Overview
Example
Object Model
Syntax
Visual Basic (Declaration)
Public Class C1ZStreamWriter
Inherits System.IO.Stream
C#
public class C1ZStreamWriter : System.IO.Stream
Remarks
To compress data into a stream, create a C1ZStreamWriter object passing the stream to the
C1ZStreamWriter constructor.
Then write the data into the C1ZStreamWriter using the Write method, or create a
System.IO.StreamWriter on the C1ZStreamWriter. The second option is indicated when you
want to write formatted data.
When you are done writing the data, call the Close method to flush the data and close the
underlying stream.
Example
The code below compresses a string into a memory stream:
C#
Inheritance Hierarchy
System.Object
System.MarshalByRefObject
System.IO.Stream
C1.C1Zip.C1ZStreamWriter
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Members
C1.C1Zip Namespace
Members
Properties Methods
Public Constructors
Name
Description
Public Properties
Name
Description
BaseStream
CanRead
CanSeek
CanTimeout
CanWrite
Checksum
Length
OwnsBaseStream
Gets or sets whether calling the Close method will also close the
underlying stream (see BaseStream).
Position
ReadTimeout
SizeCompressed
SizeCompressedLong
SizeUncompressed
Gets the number of bytes that were compressed into the stream
(uncompressed bytes).
SizeUncompressedLong Gets the number of bytes that were compressed into the stream
(uncompressed bytes).
Top
WriteTimeout
ZStream
Public Methods
Name
Description
BeginRead
BeginWrite
Close
Overridden.
Closes the current stream compressor and flushed any pending
data into the base stream.
If the OwnsBaseStream property is set to True (the default value),
then this method also closes the base stream and releases any
resources (such as sockets and file handles) associated with it.
CopyTo
CopyToAsync
CreateObjRef
Dispose
EndRead
EndWrite
Flush
Overridden. Clears all buffers for this stream and causes any
buffered data to be written to the underlying stream.
FlushAsync
GetLifetimeService
Read
ReadAsync
ReadByte
Seek
SetLength
Write
WriteAsync
WriteByte
Top
See Also
Reference
C1ZStreamWriter Class
C1.C1Zip Namespace
C1ZStreamWriter Constructor
Overload List
Overload
Description
C1ZStreamWriter Constructor(Stream)
Initializes a new
instance of the
C1ZStreamWrite
r class.
C1ZStreamWriter Constructor(Stream,Boolean)
Initializes a new
instance of the
C1ZStreamWrite
r class.
C1ZStreamWriter Constructor(Stream,Boolean,Boolean)
Initializes a new
instance of the
C1ZStreamWrite
r class.
C1ZStreamWriter Constructor(Stream,CompressionLevelEnum)
Initializes a new
instance of the
C1ZStreamWrite
r class.
C1ZStreamWriter Constructor(Stream,CompressionLevelEnum,Boolean)
Initializes a new
instance of the
C1ZStreamWrite
r class.
C1ZStreamWriter
Initializes a new
Constructor(Stream,CompressionLevelEnum,Boolean,Boolean)
instance of the
C1ZStreamWrite
r class.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
C1ZStreamWriter Constructor(Stream)
Output stream that will contain the compressed data.
Initializes a new instance of the C1ZStreamWriter class.
Syntax
Parameters
baseStream
Output stream that will contain the compressed data.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Overload List
C1ZStreamWriter Constructor(Stream,Boolean)
Output stream that will contain the compressed data.
Specifies whether the compressed stream should be compatible with zip files.
Initializes a new instance of the C1ZStreamWriter class.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal baseStream As Stream, _
ByVal zip As Boolean _
)
C#
public C1ZStreamWriter(
Stream baseStream,
bool zip
)
Parameters
baseStream
Output stream that will contain the compressed data.
zip
Specifies whether the compressed stream should be compatible with zip files.
Remarks
Streams in zip files are different from regular zlib streams in two aspects:
(1) zip streams do not contain any local header information (the information is stored
in the zip file headers instead) and
(2) zip streams use a CRC32 checksum instead of the adler32 checksum used by zlib
streams.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Overload List
C1ZStreamWriter Constructor(Stream,Boolean,Boolean)
>
Name
Open
Description
Gets the Open toolstrip button.
Owner
PageSetup
Parameters
PreviewAction
PreviewControl
PrintLayout
Reflow
Save
Stop
ToolStrip
Visible
Gets the ToolStrip containing the buttons in this toolbar. (Inherited from
C1.Win.C1Preview.C1PrintPreviewControl.PreviewToolBar)
Gets or sets a value indicating whether this toolbar is visible. (Inherited
from C1.Win.C1Preview.C1PrintPreviewControl.PreviewToolBar)
Top
See Also
Reference
C1PrintPreviewControl.FileToolBar Class
C1.Win.C1Preview Namespace
C1ZStreamWriter Constructor(Stream,CompressionLevelEnum)
Output stream that will contain the compressed data.
Compression level to use when compressing data.
Initializes a new instance of the C1ZStreamWriter class.
Syntax
Parameters
baseStream
Output stream that will contain the compressed data.
level
Compression level to use when compressing data.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Overload List
C1ZStreamWriter Constructor(Stream,CompressionLevelEnum,Boolean)
Output stream that will contain the compressed data.
Compression level to use when compressing data.
Specifies whether the compressed stream should be compatible with zip files.
Initializes a new instance of the C1ZStreamWriter class.
Syntax
Parameters
baseStream
Output stream that will contain the compressed data.
level
Compression level to use when compressing data.
zip
Specifies whether the compressed stream should be compatible with zip files.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Overload List
C1ZStreamWriter
Constructor(Stream,CompressionLevelEnum,Boolean,Boolean)
Output stream that will contain the compressed data.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal baseStream As Stream, _
ByVal level As CompressionLevelEnum, _
ByVal header As Boolean, _
ByVal crc32 As Boolean _
)
C#
public C1ZStreamWriter(
Stream baseStream,
CompressionLevelEnum level,
bool header,
bool crc32
)
Parameters
baseStream
Output stream that will contain the compressed data.
level
Compression level to use when compressing data.
header
Include header information in compressed stream (should be False for streams in zip
files).
crc32
Include CRC32 checksum in compressed stream (should be True for streams in zip files).
Requirements
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Overload List
Methods
>
Name
Description
BeginRead
BeginWrite
Close
CopyTo
CopyToAsync
CreateObjRef
Dispose
EndRead
EndWrite
Flush
Overridden. Clears all buffers for this stream and causes any
buffered data to be written to the underlying stream.
FlushAsync
GetLifetimeService
ReadAsync
ReadByte
Seek
SetLength
Write
WriteAsync
WriteByte
Top
See Also
Reference
C1ZStreamWriter Class
C1.C1Zip Namespace
Close Method
Closes the current stream compressor and flushed any pending data into the base stream.
If the OwnsBaseStream property is set to True (the default value), then this method also closes
the base stream and releases any resources (such as sockets and file handles) associated with it.
Syntax
Visual Basic (Declaration)
Public Overrides Sub Close()
C#
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Flush Method
Clears all buffers for this stream and causes any buffered data to be written to the underlying
stream.
Syntax
Visual Basic (Declaration)
Public Overrides Sub Flush()
C#
public override void Flush()
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Read Method
Not supported.
Syntax
Parameters
buf
offset
count
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Seek Method
Not supported.
Syntax
Visual Basic (Declaration)
Public Overrides Function Seek( _
ByVal offset As Long, _
Parameters
offset
origin
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
SetLength Method
Not supported.
Syntax
Visual Basic (Declaration)
Public Overrides Sub SetLength( _
ByVal value As Long _
)
C#
public override void SetLength(
long value
)
Parameters
value
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Write Method
An array of bytes. This method copies count bytes from buf to the current stream.
The zero-based byte offset in buf at which to begin copying bytes to the current stream.
The number of bytes to be written to the current stream.
Writes a sequence of bytes to the current stream and advances the current position within this
stream by the number of bytes written.
Syntax
Visual Basic (Declaration)
Public Overrides Sub Write( _
ByVal buf() As Byte, _
ByVal offset As Integer, _
ByVal count As Integer _
)
C#
public override void Write(
byte[] buf,
int offset,
int count
)
Parameters
buf
An array of bytes. This method copies count bytes from buf to the current stream.
offset
The zero-based byte offset in buf at which to begin copying bytes to the current
stream.
count
The number of bytes to be written to the current stream.
Remarks
The data is compressed as it is written into the stream. Writing count bytes into
the stream will usually advance the position by a number smaller than count.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
WriteByte Method
Value to be written to the stream.
Writes a byte to the current position in the stream and advances the position within the stream
by one byte.
Syntax
Visual Basic (Declaration)
Public Overrides Sub WriteByte( _
ByVal value As Byte _
)
C#
public override void WriteByte(
byte value
)
Parameters
value
Value to be written to the stream.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Properties
%%scrap%%
" -->
For a list of all members of this type, see C1ZStreamWriter members.
Public Properties
Name
Description
BaseStream
CanRead
CanSeek
CanTimeout
CanWrite
Checksum
Length
OwnsBaseStream
Gets or sets whether calling the Close method will also close the
underlying stream (see BaseStream).
Position
ReadTimeout
SizeCompressed
SizeCompressedLong
SizeUncompressed
Gets the number of bytes that were compressed into the stream
(uncompressed bytes).
SizeUncompressedLong Gets the number of bytes that were compressed into the stream
(uncompressed bytes).
WriteTimeout
ZStream
Top
See Also
Reference
C1ZStreamWriter Class
C1.C1Zip Namespace
BaseStream Property
Gets the underlying stream that receives the compressed data.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property BaseStream As Stream
C#
public Stream BaseStream {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
CanRead Property
Always returns False.
Syntax
Visual Basic (Declaration)
Public Overrides ReadOnly Property CanRead As Boolean
C#
public override bool CanRead {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
CanSeek Property
Always returns False.
Syntax
Visual Basic (Declaration)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
CanWrite Property
Always returns True.
Syntax
Visual Basic (Declaration)
Public Overrides ReadOnly Property CanWrite As Boolean
C#
public override bool CanWrite {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Checksum Property
Gets the checksum value used to check the integrity of the stream.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property Checksum As Integer
C#
public int Checksum {get;}
Remarks
The checksum used may be an Adler or crc32 value depending on how the C1ZStreamWriter
was created.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Length Property
Returns the length of the underlying stream, in bytes.
Syntax
Visual Basic (Declaration)
Public Overrides ReadOnly Property Length As Long
C#
public override long Length {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
OwnsBaseStream Property
Gets or sets whether calling the Close method will also close the underlying stream (see
BaseStream).
Syntax
Visual Basic (Declaration)
Public Property OwnsBaseStream As Boolean
C#
public bool OwnsBaseStream {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
Position Property
Gets the position within the stream (read-only).
Syntax
Visual Basic (Declaration)
Public Overrides Property Position As Long
C#
public override long Position {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
SizeCompressed Property
Gets the number of bytes in the stream (compressed bytes).
Syntax
Visual Basic (Declaration)
Public ReadOnly Property SizeCompressed As Integer
C#
public int SizeCompressed {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
SizeCompressedLong Property
Gets the number of bytes in the stream (compressed bytes).
Syntax
Visual Basic (Declaration)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
SizeUncompressed Property
Gets the number of bytes that were compressed into the stream (uncompressed bytes).
Syntax
Visual Basic (Declaration)
Public ReadOnly Property SizeUncompressed As Integer
C#
public int SizeUncompressed {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
SizeUncompressedLong Property
Gets the number of bytes that were compressed into the stream (uncompressed bytes).
Syntax
Visual Basic (Declaration)
Public ReadOnly Property SizeUncompressedLong As Long
C#
public long SizeUncompressedLong {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
ZStream Property
Gets the ZStream instance wrapped by this C1ZStreamWriter.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property ZStream As ZStream
C#
public ZStream ZStream {get;}
Remarks
This property is useful only in advanced applications that need to customize the low-level
behavior of the compressor. It is not needed in common applications.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1ZStreamWriter Class
C1ZStreamWriter Members
ZipFileException
Exception thrown when trying to open an invalid Zip file.
Object Model
Syntax
Visual Basic (Declaration)
Public Class ZipFileException
Inherits System.IO.IOException
C#
public class ZipFileException : System.IO.IOException
Inheritance Hierarchy
System.Object
System.Exception
System.SystemException
System.IO.IOException
C1.C1Zip.ZipFileException
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipFileException Members
C1.C1Zip Namespace
Overview
Exception thrown when trying to open an invalid Zip file.
Object Model
Syntax
Visual Basic (Declaration)
Public Class ZipFileException
Inherits System.IO.IOException
C#
public class ZipFileException : System.IO.IOException
Inheritance Hierarchy
System.Object
System.Exception
System.SystemException
System.IO.IOException
C1.C1Zip.ZipFileException
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipFileException Members
C1.C1Zip Namespace
Members
Properties Methods
Public Constructors
Name
Description
Public Properties
Name
Description
Data
HelpLink
HResult
InnerException
Message
Source
StackTrace
TargetSite
Top
Public Methods
Name
Description
Top
GetObjectData
GetType
ToString
See Also
Reference
ZipFileException Class
C1.C1Zip Namespace
ZipFileException Constructor
Overload List
Overload
Description
ZipFileException Constructor(String)
ZipFileException Constructor(String,String)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipFileException Class
ZipFileException Members
ZipFileException Constructor(String)
Message that describes the exception.
Initializes a new instance of a ZipFileException.
Syntax
Visual Basic (Declaration)
Public Function New( _
Parameters
msg
Message that describes the exception.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZipFileException Class
ZipFileException Members
Overload List
ZipFileException Constructor(String,String)
Message that describes the exception.
Name of the file that caused the exception.
Initializes a new instance of a ZipFileException.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal msg As String, _
ByVal filename As String _
)
C#
public ZipFileException(
string msg,
string filename
)
Parameters
msg
Message that describes the exception.
filename
Name of the file that caused the exception.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZipFileException Class
ZipFileException Members
Overload List
ZipFileException Constructor(String,String,Exception)
Message that describes the exception.
Name of the file that caused the exception.
Inner exception.
Initializes a new instance of a ZipFileException.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal msg As String, _
ByVal filename As String, _
ByVal innerException As Exception _
)
C#
public ZipFileException(
string msg,
string filename,
Exception innerException
)
Parameters
msg
Message that describes the exception.
filename
Name of the file that caused the exception.
innerException
Inner exception.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2
(Server Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZipFileException Class
ZipFileException Members
Overload List
ZipProgressEventArgs
Provides data for the C1ZipFile.Progress event of a C1ZipFile.
Object Model
Syntax
Visual Basic (Declaration)
Public Class ZipProgressEventArgs
Inherits System.EventArgs
C#
public class ZipProgressEventArgs : System.EventArgs
Inheritance Hierarchy
System.Object
System.EventArgs
C1.C1Zip.ZipProgressEventArgs
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipProgressEventArgs Members
C1.C1Zip Namespace
Overview
Provides data for the C1ZipFile.Progress event of a C1ZipFile.
Object Model
Syntax
Visual Basic (Declaration)
Public Class ZipProgressEventArgs
Inherits System.EventArgs
C#
public class ZipProgressEventArgs : System.EventArgs
Inheritance Hierarchy
System.Object
System.EventArgs
C1.C1Zip.ZipProgressEventArgs
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipProgressEventArgs Members
C1.C1Zip Namespace
Members
Properties
Public Properties
Name
Description
Cancel
FileLength
FileLengthLong
FileName
Position
PositionLong
Top
See Also
Reference
ZipProgressEventArgs Class
C1.C1Zip Namespace
Properties
>
Name
Description
Cancel
FileLength
FileLengthLong
FileName
Position
PositionLong
Top
See Also
Reference
ZipProgressEventArgs Class
C1.C1Zip Namespace
Cancel Property
Set to true to cancel the current operation.
Syntax
Visual Basic (Declaration)
Public Property Cancel As Boolean
C#
public bool Cancel {get; set;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipProgressEventArgs Class
ZipProgressEventArgs Members
FileLength Property
Gets the length of the file being compressed or expanded.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property FileLength As Integer
C#
public int FileLength {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipProgressEventArgs Class
ZipProgressEventArgs Members
FileLengthLong Property
Gets the length of the file being compressed or expanded.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property FileLengthLong As Long
C#
public long FileLengthLong {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipProgressEventArgs Class
ZipProgressEventArgs Members
FileName Property
Gets the name of the file being compressed or expanded.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property FileName As String
C#
public string FileName {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipProgressEventArgs Class
ZipProgressEventArgs Members
Position Property
Gets the current position into the stream.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property Position As Integer
C#
public int Position {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipProgressEventArgs Class
ZipProgressEventArgs Members
PositionLong Property
Gets the current position into the stream.
Syntax
Visual Basic (Declaration)
Public ReadOnly Property PositionLong As Long
C#
public long PositionLong {get;}
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZipProgressEventArgs Class
ZipProgressEventArgs Members
Enumerations
CompressionLevelEnum
Specifies the level of compression to be applied when adding entries to a C1ZipFile.
Syntax
Visual Basic (Declaration)
Members
Member
Description
BestCompression
BestSpeed
No Compression.
Inheritance Hierarchy
System.Object
System.ValueType
System.Enum
C1.C1Zip.CompressionLevelEnum
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
C1.C1Zip Namespace
Delegates
ZipProgressEventHandler
Represents the method that will handle the C1ZipFile.Progress event of a C1ZipFile.
Syntax
Parameters
sender
e
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZipProgressEventHandler Members
C1.C1Zip Namespace
C1.C1Zip.ZLib Namespace
Overview
Classes
Class
Description
ZStream
ZStream is the most flexible and hardest to use class in the C1.C1Zip
assembly. It contains a C# implementation of ZLIB's zstream object,
which is a general purpose compressor and decompressor.
See Also
Reference
C1.C1Zip.4 Assembly
Classes
ZStream
ZStream is the most flexible and hardest to use class in the C1.C1Zip assembly. It contains a C#
implementation of ZLIB's zstream object, which is a general purpose compressor and
decompressor.
Object Model
Syntax
Visual Basic (Declaration)
Public Class ZStream
C#
public class ZStream
Remarks
In most cases, you should be able to use the C1.C1Zip.C1ZStreamReader and
C1.C1Zip.C1ZStreamWriter classes instead of ZStream. These classes provide friendly and easyto-use wrappers that hide the ZLIB complexity.
Use ZStream only if you are familiar with ZLIB and need control over the low-level aspects of
the data compression or decompression process (e.g., to provide your own buffers or
compression dictionaries).
If you choose to use ZStream directly and need technical support, please check out the detailed
documentation, sample, and articles available at http://www.info-zip.org/ or
http://www.gzip.org/, the official zlib sites.
ZLIB is an open-source, patent-free library created by Jean-Loup Gailly and Mark Adler.
Inheritance Hierarchy
System.Object
C1.C1Zip.ZLib.ZStream
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Members
C1.C1Zip.ZLib Namespace
Overview
ZStream is the most flexible and hardest to use class in the C1.C1Zip assembly. It contains a C#
implementation of ZLIB's zstream object, which is a general purpose compressor and
decompressor.
Object Model
Syntax
Visual Basic (Declaration)
Public Class ZStream
C#
public class ZStream
Remarks
In most cases, you should be able to use the C1.C1Zip.C1ZStreamReader and
C1.C1Zip.C1ZStreamWriter classes instead of ZStream. These classes provide friendly and easyto-use wrappers that hide the ZLIB complexity.
Use ZStream only if you are familiar with ZLIB and need control over the low-level aspects of
the data compression or decompression process (e.g., to provide your own buffers or
compression dictionaries).
If you choose to use ZStream directly and need technical support, please check out the detailed
documentation, sample, and articles available at http://www.info-zip.org/ or
http://www.gzip.org/, the official zlib sites.
ZLIB is an open-source, patent-free library created by Jean-Loup Gailly and Mark Adler.
Inheritance Hierarchy
System.Object
C1.C1Zip.ZLib.ZStream
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Members
C1.C1Zip.ZLib Namespace
Members
Fields Methods
Public Constructors
Name
Description
Public Fields
Name
Description
adler
avail_in
avail_out
msg
next_in
Input buffer.
next_in_index
next_out
Output buffer.
next_out_index
total_in
total_out
Z_BUF_ERROR
Z_DATA_ERROR
Z_ERRNO
File error.
Z_MEM_ERROR
Z_NEED_DICT
Z_OK
No error.
Z_STREAM_END
Public Methods
Name
Description
deflate
deflateEnd
Frees all dynamically allocated data structures for this stream, discards
any unprocessed input, and does not flush any pending output.
deflateInit
deflateParams
deflateSetDictionary Initializes the compression dictionary from the given byte sequence
without producing any compressed output.
inflate
inflateEnd
Frees all dynamically allocated data structures for this stream, discards
any unprocessed input, and does not flush any pending output.
inflateInit
Skips invalid compressed data until a full flush point is found, or until
all available input is skipped. No output is provided.
Top
See Also
Reference
ZStream Class
C1.C1Zip.ZLib Namespace
ZStream Constructor
Overload List
Overload
Description
ZStream Constructor()
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
ZStream Constructor()
Initializes a new instance of the ZStream class using an Adler checksum.
Syntax
Visual Basic (Declaration)
Public Function New()
C#
public ZStream()
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Overload List
ZStream Constructor(Boolean)
True to use a CRC32 checksum, False to use an Adler checksum.
Initializes a new instance of the ZStream class.
Syntax
Visual Basic (Declaration)
Public Function New( _
ByVal crc32 As Boolean _
)
C#
public ZStream(
bool crc32
)
Parameters
crc32
True to use a CRC32 checksum, False to use an Adler checksum.
Remarks
CRC32 checksums are the standard used in zip files. Adler checksums are the default used
by ZLIB. Adler checksums are faster to calculate, but are not compatible with the zip
format.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Overload List
Methods
%%scrap%%
" -->
For a list of all members of this type, see ZStream members.
Public Methods
Name
Description
deflate
deflateEnd
Frees all dynamically allocated data structures for this stream, discards
any unprocessed input, and does not flush any pending output.
deflateInit
deflateParams
deflateSetDictionary Initializes the compression dictionary from the given byte sequence
without producing any compressed output.
inflate
inflateEnd
Frees all dynamically allocated data structures for this stream, discards
any unprocessed input, and does not flush any pending output.
inflateInit
Skips invalid compressed data until a full flush point is found, or until
all available input is skipped. No output is provided.
Top
See Also
Reference
ZStream Class
C1.C1Zip.ZLib Namespace
deflate Method
Non-zero to force some data to be flushed into the output buffer.
Compresses as much data as possible, and stops when the input buffer becomes empty or the
output buffer becomes full.
Syntax
Visual Basic (Declaration)
Public Function deflate( _
ByVal flush As Integer _
) As Integer
C#
public int deflate(
int flush
)
Parameters
flush
Non-zero to force some data to be flushed into the output buffer.
Return Value
Zero on success, an error code on failure.
Remarks
deflate performs one or both of the following actions:
1. Compress more input starting at next_in and update next_in and avail_in accordingly.
If not all input can be processed (because there is not enough room in the output buffer),
next_in and avail_in are updated and processing will resume at this point for the next call
to deflate.
2. Provide more output starting at next_out and update next_out and avail_out
accordingly. This action is forced if the parameter flush is non zero. Forcing flush
frequently degrades the compression ratio, so this parameter should be set only when
necessary (in interactive applications). Some output may be provided even if flush is not
set
This method may introduce some output latency (reading input without producing any
output) except when forced to flush.
If deflate returns with avail_out == 0, this method must be called again with the same
value of the flush parameter and more output space until the flush is complete (deflate
returns with avail_out != 0).
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
deflateEnd Method
Frees all dynamically allocated data structures for this stream, discards any unprocessed input,
and does not flush any pending output.
Syntax
Visual Basic (Declaration)
Public Function deflateEnd() As Integer
C#
public int deflateEnd()
Return Value
Zero on success, an error code on failure.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
deflateInit Method
Initializes the internal stream state for compression.
Overload List
Overload
Description
deflateInit(Int32)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
deflateInit(Int32) Method
Compression level between zero and nine (0-9).
Initializes the internal stream state for compression.
Syntax
Visual Basic (Declaration)
Public Overloads Function deflateInit( _
ByVal level As Integer _
) As Integer
C#
public int deflateInit(
int level
Parameters
level
Compression level between zero and nine (0-9).
Return Value
Zero on success, an error code on failure.
Remarks
Compression level 1 gives best speed, 9 gives best compression.
Compression level zero gives no compression at all (the input data is simply copied a
block at a time).
The default compression level is 6, which provides a compromise between speed and
compression.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Overload List
deflateInit(Int32,Int32) Method
Compression level between zero and nine (0-9).
Size of the LZ77 sliding compression window in bits (the default value is 15 bits).
Initializes the internal stream state for compression.
Syntax
Visual Basic (Declaration)
Public Overloads Function deflateInit( _
ByVal level As Integer, _
Parameters
level
Compression level between zero and nine (0-9).
bits
Size of the LZ77 sliding compression window in bits (the default value is 15 bits).
Return Value
Zero on success, an error code on failure.
Remarks
Compression level 1 gives best speed, 9 gives best compression.
Compression level zero gives no compression at all (the input data is simply copied a
block at a time).
The default compression level is 6, which provides a compromise between speed and
compression.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Overload List
deflateParams Method
Compression level between zero and nine (0-9).
Compression strategy (0-2).
Dynamically updates the compression level and compression strategy.
Syntax
Visual Basic (Declaration)
Public Function deflateParams( _
ByVal level As Integer, _
ByVal strategy As Integer _
) As Integer
C#
public int deflateParams(
int level,
int strategy
)
Parameters
level
Compression level between zero and nine (0-9).
strategy
Compression strategy (0-2).
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
deflateSetDictionary Method
Data in the dictionary.
Syntax
Visual Basic (Declaration)
Public Function deflateSetDictionary( _
ByVal dictionary() As Byte, _
ByVal dictLength As Integer _
) As Integer
C#
public int deflateSetDictionary(
byte[] dictionary,
int dictLength
)
Parameters
dictionary
Data in the dictionary.
dictLength
Number of bytes in the dictionary.
Return Value
Zero on success, an error code on failure.
Remarks
This method must be called immediately after deflateInit(Int32), before any call to
deflate.
The compressor and decompressor must use exactly the same dictionary (see
inflateSetDictionary).
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
inflate Method
How to flush data into the output buffer (default value is 2).
Decompresses as much data as possible until the input buffer is exhausted or the output buffer
is full.
Syntax
Visual Basic (Declaration)
Public Function inflate( _
ByVal flush As Integer _
) As Integer
C#
public int inflate(
int flush
)
Parameters
flush
How to flush data into the output buffer (default value is 2).
Return Value
Z_OK if some progress has been made (more input processed or more output produced),
Z_STREAM_END if the end of the compressed data has been reached and all
uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed
at this point, Z_DATA_ERROR if the input data was corrupted (input stream not
conforming to the zlib format or incorrect checksum), Z_STREAM_ERROR if the stream
structure was inconsistent (for example if next_in or next_out was null), Z_MEM_ERROR if
there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was
not enough room in the output buffer when Z_FINISH is used.
Remarks
inflate performs one or both of the following actions:
1. Decompress more input starting at next_in and update next_in and avail_in
accordingly. If not all input can be processed (because there is not enough room in the
output buffer), next_in is updated and processing will resume at this point for the next call
to inflate.
2. Provide more output starting at next_out and update next_out and avail_out
accordingly. inflate provides as much output as possible, until there is no more input data
or no more space in the output buffer.
Before the call to inflate, the application should ensure that at least one of the actions is
possible, by providing more input and/or consuming more output, and updating the
next_* and avail_* values accordingly.
If inflate returns Zero and avail_out == 0, it must be called again after making room in
the output buffer because there might be more output pending.
The application can consume the uncompressed output when it wants, for example when
the output buffer is full (avail_out == 0), or after each call of inflate.
This method may introduce some output latency (reading input without producing any
output) except when forced to flush.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
inflateEnd Method
Frees all dynamically allocated data structures for this stream, discards any unprocessed input,
and does not flush any pending output.
Syntax
Visual Basic (Declaration)
Public Function inflateEnd() As Integer
C#
public int inflateEnd()
Return Value
Zero on success, an error code on failure.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
inflateInit Method
Initializes the internal stream state for decompression.
Overload List
Overload
Description
inflateInit()
inflateInit(Int32)
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
inflateInit() Method
Initializes the internal stream state for decompression.
Syntax
Return Value
Zero on success, an error code on failure.
Remarks
The fields next_in and avail_in must be initialized before by the caller.
inflateInit does not perform any decompression apart from reading the zlib header if present:
data decompression is done by the inflate method. Therefore, the next_in and avail_in may be
modified, but next_out and avail_out are unchanged.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Overload List
inflateInit(Int32) Method
Size of the LZ77 sliding compression window in bits (the default value is 15 bits).
Initializes the internal stream state for decompression.
Syntax
Visual Basic (Declaration)
Public Overloads Function inflateInit( _
ByVal bits As Integer _
) As Integer
C#
public int inflateInit(
int bits
)
Parameters
bits
Size of the LZ77 sliding compression window in bits (the default value is 15 bits).
Return Value
Zero on success, an error code on failure.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows
Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported
with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Overload List
inflateSetDictionary Method
Data in the dictionary.
Number of bytes in the dictionary.
Initializes the decompression dictionary from the given uncompressed byte sequence.
Syntax
Visual Basic (Declaration)
Public Function inflateSetDictionary( _
ByVal dictionary() As Byte, _
ByVal dictLength As Integer _
) As Integer
C#
Parameters
dictionary
Data in the dictionary.
dictLength
Number of bytes in the dictionary.
Return Value
Zero on success, an error code on failure.
Remarks
This method must be called immediately after a call of inflate if this call returned
Z_NEED_DICT. The dictionary chosen by the compressor can be determined from
the Adler32 value returned by this call to inflate.
The compressor and decompressor must use exactly the same dictionary (see the
deflateSetDictionary method).
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3,
Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server
Core supported with SP1 or later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
inflateSync Method
Skips invalid compressed data until a full flush point is found, or until all available input is
skipped. No output is provided.
Syntax
Visual Basic (Declaration)
Return Value
Zero on success, an error code on failure.
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Fields
%%scrap%%
" -->
For a list of all members of this type, see ZStream members.
Public Fields
Name
Description
adler
avail_in
avail_out
msg
next_in
Input buffer.
next_in_index
next_out
Output buffer.
next_out_index
total_in
total_out
Z_BUF_ERROR
Z_DATA_ERROR
Z_ERRNO
File error.
Z_MEM_ERROR
Z_NEED_DICT
Z_OK
No error.
Z_STREAM_END
See Also
Reference
ZStream Class
C1.C1Zip.ZLib Namespace
adler Field
Current checksum value (Adler or CRC32).
Syntax
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
avail_in Field
Number of bytes available in the input buffer.
Syntax
Visual Basic (Declaration)
Public avail_in As Integer
C#
public int avail_in
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
avail_out Field
Number of free bytes remaining in output buffer.
Syntax
Visual Basic (Declaration)
Public avail_out As Integer
C#
public int avail_out
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
msg Field
Description of the last error (null if no errors).
Syntax
Visual Basic (Declaration)
Public msg As String
C#
public string msg
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
next_in Field
Input buffer.
Syntax
Visual Basic (Declaration)
Public next_in As Byte()
C#
public byte[] next_in
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
next_in_index Field
Position of cursor into input buffer.
Syntax
Visual Basic (Declaration)
Public next_in_index As Integer
C#
public int next_in_index
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
next_out Field
Output buffer.
Syntax
Visual Basic (Declaration)
Public next_out As Byte()
C#
public byte[] next_out
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
next_out_index Field
Position of cursor into the output buffer.
Syntax
Visual Basic (Declaration)
Public next_out_index As Integer
C#
public int next_out_index
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
total_in Field
Total number of input bytes read so far.
Syntax
Visual Basic (Declaration)
Public total_in As Long
C#
public long total_in
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
total_out Field
Total number of bytes output so far.
Syntax
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Z_BUF_ERROR Field
No progress possible or no room in output buffer.
Syntax
Visual Basic (Declaration)
Public Const Z_BUF_ERROR As Integer
C#
public const int Z_BUF_ERROR
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Z_DATA_ERROR Field
Input data is corrupted (wrong format or checksum).
Syntax
Visual Basic (Declaration)
Public Const Z_DATA_ERROR As Integer
C#
public const int Z_DATA_ERROR
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Z_ERRNO Field
File error.
Syntax
Visual Basic (Declaration)
Public Const Z_ERRNO As Integer
C#
public const int Z_ERRNO
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Z_MEM_ERROR Field
Not enough memory.
Syntax
Visual Basic (Declaration)
Public Const Z_MEM_ERROR As Integer
C#
public const int Z_MEM_ERROR
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Z_NEED_DICT Field
A preset dictionary is needed at this point.
Syntax
Visual Basic (Declaration)
Public Const Z_NEED_DICT As Integer
C#
public const int Z_NEED_DICT
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Z_OK Field
No error.
Syntax
Visual Basic (Declaration)
Public Const Z_OK As Integer
C#
public const int Z_OK
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Z_STREAM_END Field
End of stream detected.
Syntax
Visual Basic (Declaration)
Public Const Z_STREAM_END As Integer
C#
public const int Z_STREAM_END
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Z_STREAM_ERROR Field
Stream structure is inconsistent (input/output buffers are null for example).
Syntax
Visual Basic (Declaration)
Public Const Z_STREAM_ERROR As Integer
C#
public const int Z_STREAM_ERROR
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
Z_VERSION_ERROR Field
Incompatible ZLIB version.
Syntax
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStream Class
ZStream Members
ZStreamException
The exception that is thrown when reading or writing to a compressed stream fails.
Object Model
Syntax
Visual Basic (Declaration)
Public Class ZStreamException
Inherits System.ApplicationException
C#
public class ZStreamException : System.ApplicationException
Inheritance Hierarchy
System.Object
System.Exception
System.ApplicationException
C1.C1Zip.ZLib.ZStreamException
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStreamException Members
C1.C1Zip.ZLib Namespace
Overview
The exception that is thrown when reading or writing to a compressed stream fails.
Object Model
Syntax
Visual Basic (Declaration)
Public Class ZStreamException
Inherits System.ApplicationException
C#
public class ZStreamException : System.ApplicationException
Inheritance Hierarchy
System.Object
System.Exception
System.ApplicationException
C1.C1Zip.ZLib.ZStreamException
Requirements
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server
2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or
later), Windows Server 2003 SP2
See Also
Reference
ZStreamException Members
C1.C1Zip.ZLib Namespace
Members
Properties Methods
Public Properties
Name
Description
Data
HelpLink
HResult
InnerException
Message
Source
StackTrace
TargetSite
Top
Public Methods
Name
Description
GetType
ToString
Top
See Also
Reference
ZStreamException Class
C1.C1Zip.ZLib Namespace