/// <summary>
/// 解压缩
/// </summary>
/// <param name="zipBytes">待解压数据</param>
/// <returns></returns>
public static byte[] UnZip(byte[] zipBytes)
{
ICSharpCode.SharpZipLib.Zip.ZipInputStream zipStream = null;
ICSharpCode.SharpZipLib.Zip.ZipEntry ent = null;
byte[] reslutBytes = null;
try
{
using (System.IO.MemoryStream inputZipStream = new System.IO.MemoryStream(zipBytes))
{
zipStream = new ICSharpCode.SharpZipLib.Zip.ZipInputStream(inputZipStream);
if ((ent = zipStream.GetNextEntry()) != null)
{
reslutBytes = new byte[zipStream.Length];
zipStream.Read(reslutBytes, 0, reslutBytes.Length);
}
}
}
finally
{
if (zipStream != null)
{
zipStream.Close();
zipStream.Dispose();
}
if (ent != null)
{
ent = null;
}
GC.Collect();
GC.Collect(1);
}
return(reslutBytes);
}