yallie / unzip

Tiny unzip helper class for .NET 3.5 Client Profile and Mono 2.10, written in pure C#.
http://nuget.org/packages/unzip
MIT License
28 stars 3 forks source link

Added very trivial progress indication support #3

Closed perlun closed 11 years ago

perlun commented 11 years ago

Hi,

This one I also added to my own copy of the file, but I want to contribute it back to you so I can do NuGet updates. :smile: It should be a no-brainer really; you get access to an event handler which will get called by Unzip.cs as the unzipping proceeds.

(As a slight side note, the crc32 code you added could take some cleanups I think. Not criticizing it as so, just seeing "room for improvement". I am not volunteering at the moment for lack of time, but it feels like the current implementation strongly breaks the separation of concerns design principle, where all the actual code for calculating the CRC32 is inline in the actual unzipping code. It would be better to try to keep that part in a separate method, or even a sub-class of its own wouldn't be improper in this case.)

Best regards, Per

yallie commented 11 years ago

Hi Per, thank you for the contribution!

but it feels like the current implementation strongly breaks the separation of concerns design principle

Hmm, how do you propose to fix that? I can't, for example, accumulate the data to compute CRC32 later as it would inroduce too much memory pressure and render Unzip unusable for large archives.

you get access to an event handler

As for this event, I am going to convert it to EventArgs-based handler. Will ProgressChangedEventArgs suit your needs? Using it, I can pass the file name along with the percentage.