mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
Search for entries in zip archive #482
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @neumatho on GitHub (Sep 26, 2021).
If you open an entry in a zip archive and while you have it opened, search for another entry, the first entry is not complete. Here is an example:
It this case, the len variable is zero, which means nothing has been copied to the MemoryStream. If you uncomment the entry1 search (which do not find anything), then it works fine. Also if I change the entry1 search to search for the same entry (or some other entry that does exists), it also work. It seems to fail, if the search did not find anything.
I have attached the test archive, but I guess you can use any archive.
sfx2.angel_harp.zip
@adamhathcock commented on GitHub (Sep 27, 2021):
Don't do that then.
Opening an entry stream is manipulating the stream's location to read the correct bytes. The Entries collection is loaded lazily behind the scenes which is also manipulating the stream's location. Doing both at the same time is bad.
Generally don't do anything else with the archive while using OpenEntryStream until you close it.
@neumatho commented on GitHub (Sep 27, 2021):
Ok, I will then update my code.