[PR #1044] [MERGED] Unified progress reporting for compression and extraction operations #1469

Open
opened 2026-01-29 22:20:43 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/1044
Author: @Copilot
Created: 11/27/2025
Status: Merged
Merged: 12/19/2025
Merged by: @adamhathcock

Base: masterHead: copilot/add-progress-reporting


📝 Commits (10+)

  • d4380b6 Initial plan
  • c082d42 Changes before error encountered
  • 0d487df Add IProgress support for compression operations with tests
  • 0f374b2 Address code review: ProgressReportingStream now throws on writes
  • aa0356d Changes before error encountered
  • 8fc5ca5 Unify progress reporting: remove IExtractionListener and add IProgress support for reading
  • 7af029b Address code review: properly handle zero-sized entries in progress reporting
  • e2df789 Remove IArchiveExtractionListener and add IProgress support to Archive Entry extraction
  • 0fdf9c7 Address code review: Replace dynamic with IArchiveProgressInfo interface
  • 14d432e Pass progress as parameter to WriteTo/WriteToAsync instead of storing on archive

📊 Changes

29 files changed (+987 additions, -475 deletions)

View changed files

📝 AGENTS.md (+3 -1)
📝 build/Program.cs (+11 -2)
📝 src/SharpCompress/Archives/AbstractArchive.cs (+4 -41)
📝 src/SharpCompress/Archives/IArchive.cs (+0 -6)
📝 src/SharpCompress/Archives/IArchiveEntryExtensions.cs (+66 -30)
src/SharpCompress/Archives/IArchiveExtractionListener.cs (+0 -10)
📝 src/SharpCompress/Archives/Rar/RarArchiveEntry.cs (+4 -4)
src/SharpCompress/Common/ArchiveExtractionEventArgs.cs (+0 -10)
src/SharpCompress/Common/CompressedBytesReadEventArgs.cs (+0 -25)
src/SharpCompress/Common/FilePartExtractionBeginEventArgs.cs (+0 -28)
src/SharpCompress/Common/IExtractionListener.cs (+0 -7)
src/SharpCompress/Common/ProgressReport.cs (+43 -0)
src/SharpCompress/Common/ReaderExtractionEventArgs.cs (+0 -17)
📝 src/SharpCompress/Compressors/Rar/MultiVolumeReadOnlyStream.cs (+1 -37)
src/SharpCompress/IO/ListeningStream.cs (+0 -97)
src/SharpCompress/IO/ProgressReportingStream.cs (+160 -0)
📝 src/SharpCompress/Readers/AbstractReader.cs (+42 -52)
📝 src/SharpCompress/Readers/IReader.cs (+0 -5)
src/SharpCompress/Readers/IReaderExtractionListener.cs (+0 -8)
📝 src/SharpCompress/Readers/Rar/RarReader.cs (+2 -4)

...and 9 more files

📄 Description

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.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/1044 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 11/27/2025 **Status:** ✅ Merged **Merged:** 12/19/2025 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `copilot/add-progress-reporting` --- ### 📝 Commits (10+) - [`d4380b6`](https://github.com/adamhathcock/sharpcompress/commit/d4380b6bb674120bd57d351ea83ef9cdc2c7ebfe) Initial plan - [`c082d42`](https://github.com/adamhathcock/sharpcompress/commit/c082d4203b46cfd1a70ec4d4fec4d453a650e9e3) Changes before error encountered - [`0d487df`](https://github.com/adamhathcock/sharpcompress/commit/0d487df61be7762abdbcb72ae56cdee8f2ebbf51) Add IProgress support for compression operations with tests - [`0f374b2`](https://github.com/adamhathcock/sharpcompress/commit/0f374b27cf90e58906329f8c7969edb372a4d243) Address code review: ProgressReportingStream now throws on writes - [`aa0356d`](https://github.com/adamhathcock/sharpcompress/commit/aa0356de9f2df0740aa00d49221c3973c9d6b627) Changes before error encountered - [`8fc5ca5`](https://github.com/adamhathcock/sharpcompress/commit/8fc5ca5a71ec5f3ed66ac17116da512e74b39231) Unify progress reporting: remove IExtractionListener and add IProgress support for reading - [`7af029b`](https://github.com/adamhathcock/sharpcompress/commit/7af029b5de8c12a7d7723809525433a8f91658ee) Address code review: properly handle zero-sized entries in progress reporting - [`e2df789`](https://github.com/adamhathcock/sharpcompress/commit/e2df7894f98bff34cd850512b0749d02d1c30677) Remove IArchiveExtractionListener and add IProgress support to Archive Entry extraction - [`0fdf9c7`](https://github.com/adamhathcock/sharpcompress/commit/0fdf9c74a8135bc4681bd75000c392b654810910) Address code review: Replace dynamic with IArchiveProgressInfo interface - [`14d432e`](https://github.com/adamhathcock/sharpcompress/commit/14d432e22ddf56b1fc1b5f1127aa9b445dadef98) Pass progress as parameter to WriteTo/WriteToAsync instead of storing on archive ### 📊 Changes **29 files changed** (+987 additions, -475 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+3 -1) 📝 `build/Program.cs` (+11 -2) 📝 `src/SharpCompress/Archives/AbstractArchive.cs` (+4 -41) 📝 `src/SharpCompress/Archives/IArchive.cs` (+0 -6) 📝 `src/SharpCompress/Archives/IArchiveEntryExtensions.cs` (+66 -30) ➖ `src/SharpCompress/Archives/IArchiveExtractionListener.cs` (+0 -10) 📝 `src/SharpCompress/Archives/Rar/RarArchiveEntry.cs` (+4 -4) ➖ `src/SharpCompress/Common/ArchiveExtractionEventArgs.cs` (+0 -10) ➖ `src/SharpCompress/Common/CompressedBytesReadEventArgs.cs` (+0 -25) ➖ `src/SharpCompress/Common/FilePartExtractionBeginEventArgs.cs` (+0 -28) ➖ `src/SharpCompress/Common/IExtractionListener.cs` (+0 -7) ➕ `src/SharpCompress/Common/ProgressReport.cs` (+43 -0) ➖ `src/SharpCompress/Common/ReaderExtractionEventArgs.cs` (+0 -17) 📝 `src/SharpCompress/Compressors/Rar/MultiVolumeReadOnlyStream.cs` (+1 -37) ➖ `src/SharpCompress/IO/ListeningStream.cs` (+0 -97) ➕ `src/SharpCompress/IO/ProgressReportingStream.cs` (+160 -0) 📝 `src/SharpCompress/Readers/AbstractReader.cs` (+42 -52) 📝 `src/SharpCompress/Readers/IReader.cs` (+0 -5) ➖ `src/SharpCompress/Readers/IReaderExtractionListener.cs` (+0 -8) 📝 `src/SharpCompress/Readers/Rar/RarReader.cs` (+2 -4) _...and 9 more files_ </details> ### 📄 Description ## 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 <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *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<T> 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) > > <comments> > </comments> > </details> - Fixes adamhathcock/sharpcompress#1027 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/adamhathcock/sharpcompress/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:20:43 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1469