Skip to content

Added ArchiveComment Property to ZipArchive#341

Open
dos-ise wants to merge 3 commits into
adamhathcock:masterfrom
dos-ise:ReadArchiveComment
Open

Added ArchiveComment Property to ZipArchive#341
dos-ise wants to merge 3 commits into
adamhathcock:masterfrom
dos-ise:ReadArchiveComment

Conversation

@dos-ise
Copy link
Copy Markdown

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

Added ArchiveComment Property to ZipArchive

@dos-ise dos-ise mentioned this pull request Jan 18, 2018
var entry = new DirectoryEndHeader();
entry.Read(reader);

var comm = new ArchiveEncoding().Decode(entry.Comment);
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants