日期:2014-05-17 浏览次数:20845 次
ZipInputStream zipInputStream = new ZipInputStream(File.OpenRead("test.zip"));
ZipEntry zipEntry;
while ((zipEntry = zipInputStream.GetNextEntry()) != null)
{
string fileName = Path.GetFileName(zipEntry.Name);
FileStream streamWriter = null;
streamWriter = File.Create(fileName);
int size = 2048;
byte[] data = new byte[2048];
while (true)
{
size = zipInputStream.Read(data, 0, data.Length);
if (size > 0)
{
streamWriter.Write(data, 0, size);
}
else
{
break;
}
}
streamWriter.Close();