Reduce custom utilities for arrays/bytes#967
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the utility library by removing custom implementations in favor of framework-provided functionality. The changes reduce maintenance burden and leverage well-tested platform APIs, particularly for stream operations and array handling.
Key changes include:
- Replacing custom
TransferTowith framework'sCopyTofor stream operations - Using
Buffer.BlockCopyinstead of custom array copy wrapper - Consolidating namespace structure by removing the
Helpersnamespace - Adding comprehensive unit tests for existing utility methods
Reviewed Changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/SharpCompress.Test/UtilityTests.cs | Adds comprehensive test coverage for utility methods including URShift, ReadFully, Skip, date conversions, and other helper functions |
| tests/SharpCompress.Test/TestBase.cs | Removes global using directive for Helpers namespace |
| tests/SharpCompress.Test/Tar/TarReaderTests.cs | Replaces TransferTo with standard CopyTo |
| tests/SharpCompress.Test/Rar/RarReaderTests.cs | Replaces TransferTo with standard CopyTo |
| src/SharpCompress/Writers/Zip/ZipWriter.cs | Replaces TransferTo with standard CopyTo |
| src/SharpCompress/Writers/GZip/GZipWriter.cs | Replaces TransferTo with standard CopyTo |
| src/SharpCompress/Utility.cs | Removes custom array copy, TransferTo overloads, Find, CheckNotNull methods; refactors Skip methods; adds NET60_OR_GREATER conditional compilation for ReadFully |
| src/SharpCompress/Readers/Zip/ZipReader.cs | Updates CheckNotNull to NotNull |
| src/SharpCompress/Readers/Tar/TarReader.cs | Updates CheckNotNull to NotNull |
| src/SharpCompress/Readers/ReaderFactory.cs | Updates CheckNotNullOrEmpty to NotNullOrEmpty and CheckNotNull to NotNull |
| src/SharpCompress/Readers/Rar/RarReader.cs | Updates CheckNotNullOrEmpty to NotNullOrEmpty and CheckNotNull to NotNull |
| src/SharpCompress/Readers/GZip/GZipReader.cs | Updates CheckNotNull to NotNull |
| src/SharpCompress/Readers/Arc/ArcReader.cs | Updates CheckNotNull to NotNull |
| src/SharpCompress/NotNullExtensions.cs | Adds NotNullOrEmpty method and updates Empty methods to use collection expression syntax |
| src/SharpCompress/LazyReadOnlyCollection.cs | Updates namespace from Helpers to SharpCompress |
| src/SharpCompress/Factories/Factory.cs | Updates CheckNotNull to NotNull |
| src/SharpCompress/Compressors/Rar/UnpackV2017/Unpack.unpack50_cpp.cs | Replaces custom Copy with Buffer.BlockCopy |
| src/SharpCompress/Archives/Zip/ZipArchive.cs | Updates CheckNotNullOrEmpty to NotNull and CheckNotNull to NotNull |
| src/SharpCompress/Archives/Tar/TarArchive.cs | Updates CheckNotNullOrEmpty to NotNullOrEmpty and CheckNotNull to NotNull; replaces TransferTo with CopyTo |
| src/SharpCompress/Archives/SevenZip/SevenZipArchive.cs | Updates CheckNotNullOrEmpty to NotNullOrEmpty and CheckNotNull to NotNull |
| src/SharpCompress/Archives/Rar/RarArchive.cs | Updates CheckNotNullOrEmpty to NotNullOrEmpty and CheckNotNull to NotNull |
| src/SharpCompress/Archives/IArchiveEntryExtensions.cs | Replaces TransferTo with standard CopyTo |
| src/SharpCompress/Archives/GZip/GZipArchive.cs | Updates CheckNotNullOrEmpty to NotNullOrEmpty and CheckNotNull to NotNull |
| src/SharpCompress/Archives/ArchiveFactory.cs | Updates CheckNotNullOrEmpty to NotNullOrEmpty and CheckNotNull to NotNull |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Trust the framework