This snippet is useful if you would like to decompress a file zip with 1 level of directory inside.
static .. ZippedFilesFromStream(Stream s)
{
using (ZipInputStream zis = new ZipInputStream(s))
{
ZipEntry ze = null;
while ((ze = zis.GetNextEntry()) != null)
{
MemoryStream ms = null;
try
{
byte[] buffer = new byte[zis.Length];
zis.Read(buffer, 0, (int)zis.Length);
ms = new MemoryStream(buffer);
// you can work with ze.Name
// ..
}
catch (Exception x)
{
throw x;
}
finally
{
if (ms != null)
ms.Close();
}
}
}
}