This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
More accurate compressing and decompressing percent #78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #67.
The 7z library calls SetCompleted() and SetTotal(), but these calls do not appear to be used (at least, SetCompleted() doesn't). These are the values that seem to back the actual progressbar in 7z's UI and command line versions.
After working with this library's compression and decompression code for some time I have found it is not accurate, seemingly tied to buffers or something rather than the actual progressbar values that 7z.dll is reporting. This corrects this by adding a "Progressing" event that returns a new DetailedProgressEventArgs object that tells you the total and the amount completed. I did not change the Extracting callback to ensure backwards compatibility even though I have noticed it is not always 100% accurate.
I made a small sample test project (I can add it to this PR if you want) that decompressed and then recompressed a zip file (which seemed accurate) and a 7z (which was not accurate during compression). I have noticed that when extracting some archives the progress was wrong - like when extracting certain exe archives, and this corrected those as well (not shown in this output).
The results are as follows. As you can see the compression on 7z had issues: Compressing vs Progressing is wildly different and would make for a terrible progressbar.
I did not hook this up to the async code as I have not worked with that code at all.
I am not sure why appveyor is failing tests - my test project ran fine. I'll see if I can get local tests to run (they don't seem to run, they just say they were skipped). A fresh checkout of the repo cannot seem to run the tests, seems to complain about not being able to find testhost.dll.