I'm using the latest version of DotNetZip, and I have a zip file with 5 XMLs on it.
I want to open the zip, read the XML files and set a String with the value of the XML.
How can I do this?
Code:
//thats my old way of doing it.But I needed the path, now I want to read from the memory
string xfile = System.IO.File.ReadAllText(strNewFilePath, System.Text.Encoding.Default);
using (ZipFile zip = ZipFile.Read(this.uplZip.PostedFile.InputStream))
{
foreach (ZipEntry theEntry in zip)
{
//What should I use here, Extract ?
}
}
Thanks
ZipEntry
has anExtract()
overload which extracts to a stream. (1)Mixing in this answer to How do you get a string from a MemoryStream?, you'd get something like this (completely untested):