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

Add new event handler to allow tracking of progress of extraction progress for individual entry #226

Merged
merged 6 commits into from Apr 25, 2017

Conversation

Projects
None yet
2 participants
@gardebring

gardebring commented Apr 25, 2017

Add new event handler to allow tracking of progress of extraction progress for individual entry. This allows for showing or logging progress of the extraction process, especially useful for large files that might take a long time to extract.

This allows us to assign an event to the reader as such:
reader.EntryExtractionProgress += Reader_EntryExtractionProgress;

And then for example use it as such:
`
private int lastPercentage = -1;
//---//

private void Reader_EntryExtractionProgress(object sender, ReaderExtractionEventArgs e)
{
var progress = (SharpCompress.Readers.ReaderProgress)e.ParamList[0];
if (progress.PercentageRead % 10 == 0 && lastPercentage != progress.PercentageRead)
{
// Do something for every 10 percent of the extraction
}
}
`

Anders Gardebring added some commits Apr 20, 2017

Anders Gardebring
Add new feature to allow injection of an action into the extraction p…
…rocess. This allows for showing or logging progress of the extraction process, especially useful for large files that might take a long time to extract.
Anders Gardebring
Revert "Add new feature to allow injection of an action into the extr…
…action process. This allows for showing or logging progress of the extraction process, especially useful for large files that might take a long time to extract."

This reverts commit 467fc2d.
Anders Gardebring
Add new event to be able to track progress of extraction of individua…
…l entry when extracting an archive. This allows for showing or logging progress of the extraction process, especially useful for large files that might take a long time to extract.
@adamhathcock

This comment has been minimized.

Show comment
Hide comment
@adamhathcock

adamhathcock Apr 25, 2017

Owner

Why did you close the other PR to recreate it? My review comments are still the same: #225

Owner

adamhathcock commented Apr 25, 2017

Why did you close the other PR to recreate it? My review comments are still the same: #225

@gardebring

This comment has been minimized.

Show comment
Hide comment
@gardebring

gardebring Apr 25, 2017

Hi. The code is completely rewritten so I thought it made sense to close the existing one and create a new instead. Sorry if it was confusing, was not my intention. The review comments in #225 is not really valid anymore since the code is now rewritten using an event handler instead.

gardebring commented Apr 25, 2017

Hi. The code is completely rewritten so I thought it made sense to close the existing one and create a new instead. Sorry if it was confusing, was not my intention. The review comments in #225 is not really valid anymore since the code is now rewritten using an event handler instead.

@adamhathcock

This comment has been minimized.

Show comment
Hide comment
@adamhathcock

adamhathcock Apr 25, 2017

Owner

It's the same code on the same branch. Did you mean to make this pull request from a different branch other than gardebring:master ?

Owner

adamhathcock commented Apr 25, 2017

It's the same code on the same branch. Did you mean to make this pull request from a different branch other than gardebring:master ?

@gardebring

This comment has been minimized.

Show comment
Hide comment
@gardebring

gardebring Apr 25, 2017

Sorry but you lost me now.
The old code used an action as a parameter passed along. The new code use an event handler, so it is not the same code.
However, the PR do contain the old commits that were reverted.
So, first commit is old code, second is revert, third is the new code.
I can create a completely new PR with only the final change instead if you want. It will not have a functional difference, but the commit history will look nicer.

gardebring commented Apr 25, 2017

Sorry but you lost me now.
The old code used an action as a parameter passed along. The new code use an event handler, so it is not the same code.
However, the PR do contain the old commits that were reverted.
So, first commit is old code, second is revert, third is the new code.
I can create a completely new PR with only the final change instead if you want. It will not have a functional difference, but the commit history will look nicer.

@adamhathcock

This comment has been minimized.

Show comment
Hide comment
@adamhathcock

adamhathcock Apr 25, 2017

Owner

So the code is correct as you only have your master branch. Pull Requests work per branch so it was updated when you pushed the latest changes.

My review from the other Pull Request is the same as this Pull Request as it's the same branch with the same code.

Ill just move over my comments.

Owner

adamhathcock commented Apr 25, 2017

So the code is correct as you only have your master branch. Pull Requests work per branch so it was updated when you pushed the latest changes.

My review from the other Pull Request is the same as this Pull Request as it's the same branch with the same code.

Ill just move over my comments.

Show outdated Hide outdated src/SharpCompress/Common/ReaderExtractionEventArgs.cs
Show outdated Hide outdated src/SharpCompress/Readers/AbstractReader.cs
Show outdated Hide outdated src/SharpCompress/Readers/IReader.cs
public int Iterations { get; private set; }
public int PercentageRead => (int)Math.Round(PercentageReadExact);
public double PercentageReadExact => (float)BytesTransferred / _entry.Size * 100;

This comment has been minimized.

@adamhathcock

adamhathcock Apr 25, 2017

Owner

I like the way this was done

@adamhathcock

adamhathcock Apr 25, 2017

Owner

I like the way this was done

Show outdated Hide outdated src/SharpCompress/Utility.cs
@gardebring

This comment has been minimized.

Show comment
Hide comment
@gardebring

gardebring Apr 25, 2017

Hi again and thanks for feedback. For some strange reason I could not see your code comments previously, which probably explains the confusion. I will look into them and get back to you.

gardebring commented Apr 25, 2017

Hi again and thanks for feedback. For some strange reason I could not see your code comments previously, which probably explains the confusion. I will look into them and get back to you.

@gardebring

This comment has been minimized.

Show comment
Hide comment
@gardebring

gardebring Apr 25, 2017

Alright, so I believe the requested changes now has been implemented. Let me know if there is anything else :)

gardebring commented Apr 25, 2017

Alright, so I believe the requested changes now has been implemented. Let me know if there is anything else :)

@adamhathcock adamhathcock merged commit bf55595 into adamhathcock:master Apr 25, 2017

1 check passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment