Standardize extraction API to WriteToDirectory with IProgress support#1080
Conversation
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
|
@copilot merge master and check for issues |
…into copilot/refactor-write-to-directory-consistency
Merged master branch successfully (commit 17bde8d). All tests passing:
The merge included recent progress reporting changes from master which integrate cleanly with the WriteToDirectory refactoring. |
|
@copilot remove usages of Action or anything that isn't IProgress for progress |
…porting Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Replaced |
|
@copilot run check-format and document it |
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Ran
The formatting changes consolidated multi-line ProgressReport constructions to single lines for consistency. |
|
@copilot WriteToDirectory(string, ExtractionOptions?, IProgress?, CancellationToken) shouldn't be an overload as there doesn't need to be a CancellationToken for non-async methods. There should only be WriteToDirectory(string, ExtractionOptions?, IProgress?) |
Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
Standardize on WriteToDirectory Naming
This PR resolves the naming inconsistency between
WriteToDirectoryandExtractToDirectorymethods as requested in the issue.Changes Made
1. ✅ Removed
ExtractToDirectorymethodIArchiveExtensions.csto standardize onWriteToDirectorynaming2. ✅ Enhanced
WriteToDirectoryoverloadsExtractAllEntries()for optimal performanceIProgress<ProgressReport>for consistent progress reporting (without CancellationToken for sync methods)3. ✅ Added
WriteToDirectoryAsyncIArchivewith full async/await supportIProgress<ProgressReport>progress reporting, and cancellation tokens4. ✅ Updated Tests
ArchiveExtractToDirectorytest helper to useWriteToDirectoryWriteToDirectoryAsyncmethodIProgress<ProgressReport>5. ✅ Code Quality
emptyDirectorytoparentDirectory6. ✅ Merged master branch
7. ✅ Standardized on IProgress
Action<double>withIProgress<ProgressReport>for consistency with the rest of the codebase8. ✅ Code Formatting
dotnet csharpier check .anddotnet csharpier format .9. ✅ Removed CancellationToken from sync method
CancellationTokenparameter from synchronousWriteToDirectory(string, ExtractionOptions?, IProgress<ProgressReport>?)API Consistency Verification
All archive and reader types now have consistent
WriteTo*naming patterns:IArchive (IArchiveExtensions):
IArchiveEntry (IArchiveEntryExtensions):
IReader (IReaderExtensions):
ArchiveFactory (static):
Breaking Change Notice
ExtractToDirectorymethod has been removed.Migration Guide:
Test Results
Files Modified
src/SharpCompress/Archives/IArchiveExtensions.cs- Main API changes with IProgress and formattingtests/SharpCompress.Test/ArchiveTests.cs- Test helper updatetests/SharpCompress.Test/Zip/ZipArchiveAsyncTests.cs- New async tests with progressAGENTS.md- Added detailed documentation for check-format processOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.