mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-03 21:23:38 +00:00
Directories in a zip file #95
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 @glcjr on GitHub (Apr 2, 2016).
Is it possible with the reader to process a zip file that has images and then subdirectories with more images?
What I'm trying to do is to read a zipfile and put the images in a List
and I want to open any subdirectories in the zip file and add those images to my list as well.
I'm not sure how to open a directory within the zip file for this.
Basically I'm trying to create a little picture viewer program where I click next to go through the List and see the pictures display in a picturebox. Seemed simple but the subdirectories have stymied me.
This is what I've come up with so far. Just in case what I think will work is wrong...
book is just an object of a class I created with the List declared inside
@adamhathcock commented on GitHub (Apr 3, 2016):
You're thinking about how Zip file entries work slightly wrong.
Entries in Zip (and everything else really) are just key/value pairs. The keys happen to have directory information (or are a marker to say "I am a directory" with no bytes) but there is no real directory. So
foo\bar.zipis a complete key string. This just happens to mean thatbar.zipis a file in the directoryfoobut it's up to the extractor code to handle it that way or any other way you chose.@glcjr commented on GitHub (Apr 23, 2016):
Thank you! That is good information on zip files. I forgot to come back here and say that after applying it to my pictureviewer code. :)