Skip to content

Feature/enable resume download - #212

Merged
bezzad merged 47 commits into
developfrom
feature/enable_resume_download
Mar 10, 2026
Merged

Feature/enable resume download#212
bezzad merged 47 commits into
developfrom
feature/enable_resume_download

Conversation

@bezzad

@bezzad bezzad commented Feb 21, 2026

Copy link
Copy Markdown
Owner

This pull request introduces several improvements and clarifications to the downloader's documentation and codebase, focusing on download resumption, file handling, and developer experience. The most significant changes are the overhaul of the README to clarify manual and automatic resume mechanisms, updates to configuration options, and enhancements to test and build tooling.

Documentation and Configuration Improvements

  • README overhaul for resume functionality: Clarified the distinction between manual and automatic download resumption. The manual approach requires explicit serialization of the DownloadPackage object, while the automatic approach (EnableAutoResumeDownload) embeds metadata directly into the .download file, enabling seamless resumption without manual intervention. The documentation now provides detailed explanations, code examples, and notes about server requirements. [1] [2] [3]
  • Configuration option updates: Replaced EnableResumeDownload with EnableAutoResumeDownload in both documentation and sample code. Clarified the behavior of DownloadFileExtension and improved comments for configuration properties.

Developer Experience Enhancements

  • VS Code support: Added .vscode/launch.json and .vscode/tasks.json files to enable easy debugging and building of the sample project from within VS Code. [1] [2]

Codebase and Test Improvements

  • Extension namespace usage: Updated test files and main downloader code to consistently use the Downloader.Extensions namespace instead of Downloader.Extensions.Helpers. [1] [2] [3] [4] [5]
  • Test reliability: Improved the ShouldThrowExceptionIfFileExist unit test to capture exceptions via the DownloadFileCompleted event, ensuring accurate assertion and error handling. [1] [2]

Internal API Changes

  • Download logic refactoring: Refactored download methods to use a unified StartDownload method, improving maintainability and consistency in file handling. Added a binary serializer property for package metadata. [1] [2] [3] [4] [5]

These changes collectively improve usability, reliability, and clarity for both end users and developers working on or integrating the downloader library.

Comment thread src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs Outdated
Comment thread src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs Outdated
Comment thread src/Downloader.Test/UnitTests/DownloadBuilderTest.cs
@bezzad bezzad linked an issue Feb 21, 2026 that may be closed by this pull request
4 tasks

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an automatic “resume download” mechanism by persisting DownloadPackage metadata into the in-progress download file and updates docs/samples/tests/dev tooling accordingly.

Changes:

  • Replaced EnableResumeDownload with EnableAutoResumeDownload and implemented embedding/reloading of resume metadata from the .download file.
  • Added a binary serializer abstraction and implementation used for writing/reading embedded package metadata.
  • Updated README, samples, tests, and VS Code tasks/launch configs to match the new resume behavior and naming.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/Samples/Downloader.Sample/Program.cs Sample console improvements for redirected input and key handling.
src/Samples/Downloader.Sample/Program.Config.cs Sample config updated to EnableAutoResumeDownload.
src/Downloader/SocketClient.cs Updated extensions namespace import.
src/Downloader/Serializer/IBinarySerializer.cs Introduces serializer abstraction for embedded metadata.
src/Downloader/Serializer/BsonSerializer.cs Adds serializer implementation used for embedded metadata.
src/Downloader/Extensions/FileHelper.cs Moves helper namespace and minor comment tweak.
src/Downloader/Extensions/ExceptionHelper.cs Moves helper namespace and expands “momentum” error detection to inner exceptions.
src/Downloader/DownloadService.cs Implements file-based auto-resume: reads embedded metadata and truncates it on completion.
src/Downloader/DownloadPackage.cs Adds JsonIgnore to runtime/computed members to support serialization.
src/Downloader/DownloadConfiguration.cs Renames option and expands documentation for auto-resume behavior.
src/Downloader/ConcurrentStream.cs Adds ReadAsync(Memory<byte>), JSON ignores for runtime members, and minor access/spelling adjustments.
src/Downloader/ChunkDownloader.cs Minor formatting + introduces TODO block in hot loop.
src/Downloader/Chunk.cs Adds JsonIgnore to computed properties for serialization.
src/Downloader/AbstractDownloadService.cs Adds periodic package serialization to the download file when auto-resume is enabled.
src/Downloader.Test/UnitTests/FileHelperTest.cs Updates namespace usage.
src/Downloader.Test/UnitTests/DownloadBuilderTest.cs Adjusts exception-policy tests to assert via completion event.
src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs Adds extensive auto-resume integration tests and updates file-exist policy behavior assertions.
src/Downloader.Test/IntegrationTests/DownloadIntegrationTest.cs Updates namespace usage.
src/Downloader.Test/HelperTests/ExceptionHelperTest.cs Updates namespace usage.
src/Downloader.Test/GlobalUsings.cs Removes old extensions helpers global using.
src/.vscode/tasks.json Adds build task for the sample project in VS Code (when opening src as workspace).
src/.vscode/launch.json Adds VS Code debug launch configuration for the sample project.
README.md Overhauls documentation to explain manual vs automatic resume and .download file behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs Outdated
Comment thread src/Downloader/DownloadService.cs Outdated
Comment thread src/Downloader/Serializer/BsonSerializer.cs Outdated
Comment thread src/Downloader/Serializer/BsonSerializer.cs Outdated
Comment thread src/Downloader/ChunkDownloader.cs Outdated
Comment thread src/Downloader/DownloadService.cs
Comment thread src/Downloader/AbstractDownloadService.cs Outdated
Comment thread src/Downloader/AbstractDownloadService.cs Outdated
Comment thread src/Downloader/DownloadService.cs Outdated
Comment thread src/Downloader/DownloadService.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 35 out of 35 changed files in this pull request and generated 17 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Downloader.Test/UnitTests/StorageTest.cs Outdated
Comment thread src/Downloader.Test/UnitTests/StorageTest.cs Outdated
Comment thread src/Downloader/DownloadConfiguration.cs Outdated
Comment thread src/Downloader.Test/UnitTests/StorageTest.cs
Comment thread src/Downloader/ChunkDownloader.cs
Comment thread src/Downloader/Serializer/IBinarySerializer.cs
Comment thread src/Downloader/Serializer/IBinarySerializer.cs
Comment thread src/Downloader/AbstractDownloadService.cs Outdated
Comment thread README.md Outdated
Comment thread src/Downloader/AbstractDownloadService.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 35 out of 35 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Downloader.Test/UnitTests/StorageTest.cs Outdated
Comment thread src/Downloader.DummyHttpServer/HttpServer.cs
Comment thread src/.vscode/settings.json
Comment thread src/Downloader.Test/UnitTests/StorageTest.cs
Comment thread src/Downloader.Test/UnitTests/StorageTest.cs
Comment thread src/Downloader/ConcurrentStream.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 35 out of 36 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Downloader.Test/UnitTests/StorageTest.cs Outdated
Comment thread src/.vscode/settings.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Feature: Resume download from in-progress .download files

2 participants