I need to extract data from zip file that contains extra data.
When I opening it with 7-zip, it works fine, but there is warning in properties - "There are some data after the end of payload data"
But when I trying to unzip it with DotNetZip it gives me an error
using (var zip = ZipFile.Read("test.ef4"))
{
foreach (var zipEntry in zip)
{
Console.WriteLine(zipEntry.FileName);
var MemoryStream = new MemoryStream();
zipEntry.OpenReader().CopyTo(MemoryStream);
File.WriteAllBytes(zipEntry.FileName, MemoryStream.ToArray());
}
}
Exception:
Unhandled Exception: Ionic.Zip.ZipException: Cannot read that as a ZipFile
---> Ionic.Zip.BadReadException: Bad signature (0x0C000001) at position 0x00000060
How can I ignore this exception and unzip from file like 7-zip doing?
To reproduce it you can create archive with windows cmd.exe
Create archive.zip and extradata.txt with some random data. Then do this command -
copy /b archive.zip+extradata.txt