DotNetZip.Semverd
DotNetZip.Semverd copied to clipboard
Exception extracting from ZipEntry
private static MemoryStream GetClientFile(string file)
{
MemoryStream ms = new MemoryStream();
using (ZipInputStream zip = new ZipInputStream(file))
{
ZipEntry ze = zip.GetNextEntry();
while (!(ze is null))
{
if (ze.FileName.EndsWith("tag to locate entry"))
{
ze.ExtractWithPassword(ms, "password");
return ms;
}
ze = zip.GetNextEntry();
}
}
return ms;
}
When I run this I get:
System.InvalidOperationException: Use Extract() only with ZipFile.
I get no intellisense errors, and per the docs, I think I should be able to do this.
Hi, have you tried using ZipFile.Read(file) instead of ZipInputStream? Here's an example: https://github.com/haf/DotNetZip.Semverd/blob/f7e1c3547540bf43bc6819dac489e6b107b1c07a/src/Help/Code%20Examples/Csharp.htm#L279