Conversation
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/4298fab9-bd12-464d-a461-391723688d57 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/4298fab9-bd12-464d-a461-391723688d57 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Ports a small set of System.IO.File extension members into PowerKit to support creating zero-filled files and reading a file tail from a given offset (sync + async), with accompanying unit tests.
Changes:
- Added
File.WriteAllZeroes(path, count)to create/truncate a file to a specific length. - Added
File.ReadAllBytes(path, offset)andFile.ReadAllBytesAsync(path, offset, cancellationToken)to read from an offset to EOF. - Added xUnit coverage for the new extensions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| PowerKit/Extensions/FileExtensions.cs | Introduces the new File extension members (write-zeroes + read-from-offset sync/async). |
| PowerKit.Tests/FileExtensionsTests.cs | Adds tests validating zero-fill size/content and read-from-offset behavior for both sync and async APIs. |
💡 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 try to fix the build errors |
…st long to int Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/42b39082-bced-464c-a7ec-e441e8191260 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Fixed in 1663629. Two issues were causing the build failures:
|
…ength Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/1f356f16-3a5a-4ed7-ae46-4358bd1ea580 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/1f520c2f-a3c3-4f39-b1d8-ac8eabd99137 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/1f520c2f-a3c3-4f39-b1d8-ac8eabd99137 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
…t+length overloads Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/b2d744a2-3045-4163-9063-ee30228ef2ba Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
|
@copilot let's make length an |
Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/1d5098b0-7e7b-471f-bf25-97d2ad34bab3 Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Done in 7312aff. Both |
|
@copilot use the newly introduced TempFile/TestDirectory where needed |
…ath + try/finally Agent-Logs-Url: https://github.com/Tyrrrz/PowerKit/sessions/dd4b70b5-e3e1-49a9-aacf-72d58178048a Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ports the
Filestatic-class extensions from GitHubActionsTestLogger, adding an async counterpart for the read operation.New extensions
File.WriteAllZeroes(path, count)— creates/overwrites a file of exactlycountzero bytes viaSetLength(no async; it's a metadata-only syscall)File.ReadAllBytes(path, offset)— reads all bytes fromoffset(along) to EOF; returns an empty array whenoffset >= file lengthFile.ReadAllBytes(path, offset, length)— reads exactlylengthbytes starting atoffsetFile.ReadAllBytesAsync(path, offset, cancellationToken)— same as the offset-only sync version, usingReadExactlyAsyncFile.ReadAllBytesAsync(path, offset, length, cancellationToken)— same as the offset+length sync version, usingReadExactlyAsyncThe
lengthparameter in the offset+length overloads isint(matching the array size constraint), andoffsetislongto support large files.