Skip to content

Comments

Unified progress reporting for compression and extraction operations#1044

Merged
adamhathcock merged 22 commits intomasterfrom
copilot/add-progress-reporting
Dec 19, 2025
Merged

Unified progress reporting for compression and extraction operations#1044
adamhathcock merged 22 commits intomasterfrom
copilot/add-progress-reporting

Conversation

Copy link
Contributor

Copilot AI commented Nov 27, 2025

Unified progress reporting for compression and extraction operations

Adds unified progress reporting support using the IProgress<T> interface for both compression and extraction operations, similar to what 7-Zip's GUI provides.

Changes Made

New Progress Reporting API

  • ProgressReport class: Reports progress with EntryPath, BytesTransferred, TotalBytes, and PercentComplete properties
  • ProgressReportingStream: Internal stream wrapper that tracks read operations and reports progress
  • WriterOptions.Progress: IProgress<ProgressReport>? property for compression progress
  • ReaderOptions.Progress: IProgress<ProgressReport>? property for reader-based extraction progress
  • IArchiveEntry.WriteTo/WriteToAsync: Now accept optional IProgress<ProgressReport>? parameter for archive entry extraction progress

Removed Old Event-Based Progress Reporting

  • Removed IExtractionListener, IReaderExtractionListener, IArchiveExtractionListener interfaces
  • Removed ReaderProgress, ListeningStream, ArchiveExtractionEventArgs classes
  • Removed CompressedBytesReadEventArgs and FilePartExtractionBeginEventArgs
  • Removed old events from IArchive and IReader interfaces
  • Updated MultiVolumeReadOnlyStream, RarArchiveEntry, RarReader to remove listener dependencies

Merged from Master

  • ✅ Integrated new ZStandard compression implementation
  • ✅ Integrated TarHeaderWriteFormat option for TarWriter
  • ✅ All progress reporting tests pass (19 tests)
  • ✅ Code formatted with CSharpier

Fixes #1027

Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Suggestion: Saving progress</issue_title>
<issue_description>I searched existing issues and only found something related to extraction progress.
It would be very helpful to have progress reporting during compression operations, similar to what 7-Zip's GUI provides.
Ideally, this could be implemented using the IProgress interface, which would make it easy for users to read progress updates.
If a way to read saving progress is already available can you please point out how can I hook into it?</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copy link
Owner

@adamhathcock adamhathcock left a comment

Choose a reason for hiding this comment

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

Continue

Copilot AI and others added 2 commits November 27, 2025 19:15
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 27, 2025

Continue

Completed the progress reporting feature (0f374b2). Added:

  • CompressionProgress class with entry path, bytes read, total bytes, and percentage
  • IProgress<CompressionProgress> support via WriterOptions.Progress property
  • Progress reporting in ZipWriter, TarWriter, and GZipWriter
  • Comprehensive tests for the feature

Usage example:

var progress = new Progress<CompressionProgress>(p => 
    Console.WriteLine($"{p.EntryPath}: {p.PercentComplete:F1}%"));

var options = new ZipWriterOptions(CompressionType.Deflate) { Progress = progress };
using var writer = new ZipWriter(archiveStream, options);
writer.Write("file.txt", sourceStream, DateTime.Now);

Copilot AI changed the title [WIP] Add progress reporting during compression operations Add progress reporting during compression operations Nov 27, 2025
Copilot AI requested a review from adamhathcock November 27, 2025 19:21
@adamhathcock
Copy link
Owner

@copilot remove IExtractionListener and ReaderProgress in favor of this new approach. Reimplement progress for reading like this.

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
@adamhathcock
Copy link
Owner

Continue

@adamhathcock
Copy link
Owner

@copilot retry

Copilot AI and others added 2 commits November 29, 2025 17:40
…s support for reading

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
…eporting

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 29, 2025

@copilot retry

Completed the refactoring (7af029b). Removed IExtractionListener, ReaderProgress, and related event-based progress reporting. Now using unified IProgress<ProgressReport> approach for both reading and writing:

Changes made:

  • Renamed CompressionProgress to ProgressReport for unified use
  • Added ReaderOptions.Progress for extraction progress
  • Removed IExtractionListener, IReaderExtractionListener, ReaderProgress, ListeningStream
  • Removed old events from IArchive, IReader, AbstractArchive, AbstractReader
  • Updated MultiVolumeReadOnlyStream, RarArchiveEntry, RarReader to remove listener dependencies
  • Added tests for both writing and reading progress

Usage:

// Extraction progress
var progress = new Progress<ProgressReport>(p => 
    Console.WriteLine($"{p.EntryPath}: {p.PercentComplete:F1}%"));
var options = new ReaderOptions { Progress = progress };
using var reader = ReaderFactory.Open(stream, options);

Copy link
Owner

@adamhathcock adamhathcock left a comment

Choose a reason for hiding this comment

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

Archive Entry reading and writing should also have progress using the same interface and style.

Copilot AI and others added 2 commits November 30, 2025 12:00
…e Entry extraction

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
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.

Feature Suggestion: Saving progress

2 participants