Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivations
Currently if a mod download fails partway through, the already downloaded bytes are lost and have to be re-downloaded, which wastes time and network capacity.
Mods are initially downloaded to the system temp folder, which the user may not know how to control and which may not be very large, whereas the user would probably choose a high capacity drive for their download cache.
I've been trying to improve our network handling for the next release, see #3624, #3631, #3635, #3645, and #3659. This is the next big piece now that I'm warmed up.
Changes
downloading
subfolder of the main cache folder, so they will be included on that same device unless the user does some really crazymount
commands to mess with us{hash}-{description}.zip
file name format is used and queried as for the main cache, so we can easily find the matching fileWebClient
derived classes inNet.cs
, which are now moved to their own files underCore/Net
WebClient
derived class,ResumingWebClient
, is created in its own file and:HttpWebRequest.AddRange
to tell the server to skip bytes we already haveCopyTo
variant with progress reporting, because contrary to the documentation,DownloadProgressChanged
is not fired after usingOpenReadAsync
DownloadProgressChanged
NetAsyncDownloader
usesResumingWebClient
to support resuming interrupted downloadsNetModuleCache.DescribeAvailability
, and the corresponding i18n strings are migrated from GUI to CoreAfter these changes, if a download fails partway through and you try it again, it resumes where it left off. Completed downloads must still pass the gauntlet of
NetModuleCache.Store
, which checks file sizes, hashes, and ZIP validity, so if the network corrupts a download, we will throw errors rather than trying to use it.