Conversation
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/8428ef47-c8d0-4c5c-84c7-c003794f1c24 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## prime #36 +/- ##
==========================================
- Coverage 94.28% 94.08% -0.20%
==========================================
Files 76 76
Lines 1469 1489 +20
Branches 121 124 +3
==========================================
+ Hits 1385 1401 +16
- Misses 65 67 +2
- Partials 19 21 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@copilot formatting failure |
There was a problem hiding this comment.
Pull request overview
Adds a BinaryWriter counterpart to the existing BinaryReader.SkipPadding, enabling callers to write zero-byte padding until the underlying stream position is aligned to a specified boundary.
Changes:
- Add
BinaryWriterExtensions.SkipPadding(int boundaryBytes = 4)to write0x00bytes untilBaseStream.Positionaligns toboundaryBytes. - Add tests covering the unaligned and already-aligned scenarios for
SkipPadding.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| PowerKit/Extensions/BinaryWriterExtensions.cs | Introduces SkipPadding for BinaryWriter with argument validation. |
| PowerKit.Tests/BinaryWriterExtensionsTests.cs | Adds tests verifying padding behavior for aligned/unaligned positions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@copilot do we have the same argument check in the other SkipPadding method? |
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/a4cb3e63-ed27-4f37-8e33-bced60a4b22f Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
…ywriter' into copilot/add-skippadding-to-binarywriter Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
…adding Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/6a2c6fc1-67eb-4aab-91c8-930c517c0558 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
BinaryWriterlacked aSkipPaddingcounterpart to the existingBinaryReader.SkipPadding. Additionally,BinaryReaderExtensions.SkipPaddingwas missing an argument guard, which could cause a divide-by-zero for non-positiveboundaryBytesvalues.Changes
BinaryWriterExtensions— addsSkipPadding(int boundaryBytes = 4): writes0x00bytes untilBaseStream.Positionis aligned to the given boundary. Includes a guard against non-positiveboundaryBytesto prevent divide-by-zero / infinite loops.BinaryReaderExtensions— adds the sameArgumentOutOfRangeExceptionguard to the existingSkipPaddingfor consistency and to prevent divide-by-zero on non-positiveboundaryBytes.BinaryWriterExtensionsTests— adds tests for the unaligned and already-aligned cases.Usage