![]() ![]() The compressed files are stored in the \compressed directory under the application folder. The main line calls the utility function CompressFile method to compress each selected file. ( - ticks) / TimeSpan.TicksPerMillisecond,Īdd the code for CompressFile method. SizeCompressed = new FileInfo(dstFile).Length String dstFile = path DIR_COMP "\\" Path.GetFileName(srcFile) ".cmp" compress all files in application dir into compressed dir prepare to collect compression statistics Int i = path.IndexOf( (i > 0) path = path.Substring(0, i) ĭirectory.CreateDirectory(path DIR_COMP) String path = Application.ExecutablePath Private void btnCompress_Click( object sender, EventArgs e) Define the directory names for the compressed and expanded files. The Label control will display statistics about the compression/expanding process.įor WPF applications, open the MainWindow.xaml and replace the existing XAML with the following code.Īdd a reference to the C1.Zip assembly. Note that the Expand Files button cannot be used until we have some compressed files to expand. In the Properties window make the following changes: Button Start a new Visual Studio project and from the Toolbox, add two Button controls along the left edge and label control along the right edge of the form, as shown in the snapshot in the beginning of the tutorial. Now that you got an idea about the medium-level classes in C1Zip library, let's see how we can compress and decompress files on. The flow-diagram below illustrates how these classes work: This can be done by creating a C1ZStreamReader object and passing the compressed stream to the C1ZStreamReader constructor. This can be done by creating a C1ZStreamWriter object passing the stream to the C1ZStreamWriter constructor. The Zip library provides medium-level classes like C1ZStreamWriter class and C1ZStreamReader class to use data compression on any. This is highly useful when the user wants to compress all files in an application directory. C1Zip allows the user to compress individual files into compressed. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |