Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ArchiveComment Property to ZipArchive #341

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Added ArchiveComment Property to ZipArchive #341

wants to merge 3 commits into from

Conversation

dos-ise
Copy link

@dos-ise dos-ise commented Jan 16, 2018

Added ArchiveComment Property to ZipArchive

@dos-ise dos-ise mentioned this pull request Jan 18, 2018
@@ -24,7 +24,7 @@ internal IEnumerable<DirectoryEntryHeader> ReadSeekableHeader(Stream stream)
SeekBackToHeader(stream, reader, DIRECTORY_END_HEADER_BYTES);
var entry = new DirectoryEndHeader();
entry.Read(reader);

var comm = new ArchiveEncoding().Decode(entry.Comment);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't going to work properly. The instance of the encoding object needs to be passed from options. Maybe don't worry about decoding it yet.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i moved the decoding to ZipArchive.

I didn't want to change the type of Comment property on DirectoryEntryHeader.
So i converted the hex array to string and back.

Copy link
Author

@dos-ise dos-ise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i moved the decoding to ZipArchive.

I didn't want to change the type of Comment property on DirectoryEntryHeader.
So i converted the hex array to string and back.

@adamhathcock
Copy link
Owner

Now that I look at the code here. Why is this line insufficient?

Comment = ArchiveEncoding.Decode(comment);

I'm already decoding the comment there. Why are you turning that into a byte array and back?

@dos-ise
Copy link
Author

dos-ise commented Jan 19, 2018

Because it does not work. Comment is string.empty after DirectoryEntryHeader.Read() has been executed

The added test proves this.

The property Comment is string on DirectoryEntryHeader. So the only way to get the decoding from SeekableZipHeaderFactory to ZipArchive is to save it temporarliy in the already existing property.

Or do you have an better idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants