1.建立工程,新增引用,新增sharpziplib.dll
2.建立壓縮和解壓類compressionfile.cs
新增如下**
using system;
using system.io;
using icsharpcode.sharpziplib.zip;
using icsharpcode.sharpziplib.gzip;
using icsharpcode.sharpziplib.bzip2;
using icsharpcode.sharpziplib.checksums;
using icsharpcode.sharpziplib.zip.compression;
using icsharpcode.sharpziplib.zip.compression.streams;
unzipclass 解壓檔案#region unzipclass 解壓檔案
public class unzipclass
else
}streamwriter.close();}}
s.close();
}catch(exception eu)
finally
}//end unzip
}//end unzipclass
#endregion
attachmentunzip#region attachmentunzip
public class attachmentunzip
public static void upzip(string zipfile)
}#endregion
}3.建立測試頁面
3.1html
3.2 cs**
public class webform1 : system.web.ui.page
web form designer generated code#region web form designer generated code
override protected void oninit(eventargs e)
/**
/// required method for designer support - do not modify
/// the contents of this method with the code editor.
///
private void initializecomponent()
#endregion
壓縮#region 壓縮
private void button1_click(object sender, system.eventargs e)
#endregion
解壓#region 解壓
用SharpZipLib來壓縮和解壓檔案
1.建立工程,新增引用,新增sharpziplib.dll 2.建立壓縮和解壓類compressionfile.cs 新增如下 using system using system.io using icsharpcode.sharpziplib.zip using icsharpcode.sharp...
SharpZipLib壓縮解壓
using system using system.collections.generic using system.linq using system.text using system.io using icsharpcode.sharpziplib.zip namespace test zip...
C 用 SharpZipLib 壓縮解壓資料夾
首先需要在專案裡引用sharpziplib.dll。然後修改其中的關於壓縮和解壓縮的類。實現原始碼如下 壓縮檔案 using system using system.io using icsharpcode.sharpziplib.checksums using icsharpcode.sharpz...