|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IntroductionThis article shows a simple way to make a Zip/UnZip software using SharpZipLib. BackgroundSharpZipLib is a very nice OpenSource library. It's a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform. http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx Using the codeYou should use And I use a new thread to do the zip/unzip work. Because the large file may make the UI form not responding. This is the method of zip: public static void Zip(string SrcFile, string DstFile, int BufferSize)
{
FileStream fileStreamIn = new FileStream(SrcFile, FileMode.Open, FileAccess.Read);
FileStream fileStreamOut = new FileStream(DstFile, FileMode.Create, FileAccess.Write);
ZipOutputStream zipOutStream = new ZipOutputStream(fileStreamOut);
byte[] buffer = new byte
This is the method of unzip: public static void UnZip(string SrcFile, string DstFile, int BufferSize)
{
FileStream fileStreamIn = new FileStream(SrcFile, FileMode.Open, FileAccess.Read);
ZipInputStream zipInStream = new ZipInputStream(fileStreamIn);
ZipEntry entry = zipInStream.GetNextEntry();
FileStream fileStreamOut = new FileStream(DstFile + @"\" + entry.Name, FileMode.Create, FileAccess.Write);
int size;
byte[] buffer = new byte
Points of InterestSo you can see it's very easy to make a small Zip/UnZip software.SharpZipLib is very powerful and you can do a lot of things. HistorySept. 14, 2007 -- upload
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||