C1Zip Task-Based Help > Setting the Level of Compression |
To minimize the file size of the compressed file, set the compression level on the C1ZStreamWriter's constructor by using the following code.
Make sure to add these using (C#) statements at the top of the code:
C# |
Copy Code
|
---|---|
using C1.C1Zip; using Microsoft.Win32; |
C# |
Copy Code
|
---|---|
SaveFileDialog dlgSaveFile = new SaveFileDialog(); if (dlgSaveFile.ShowDialog() == true) { C1ZStreamWriter compressor = new C1ZStreamWriter(dlgSaveFile.OpenFile(), 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: