GithubHelp home page GithubHelp logo

Comments (4)

Toqe avatar Toqe commented on August 16, 2024

Please have a look at issue #2.

Basically you need to access the AlreadyDownloadedRanges property of the MultiPartDownload object you are using. You can for example serialize this to a file when closing your application. On Restart just deserialize it and provide it to the constructor of MultiPartDownload.

from downloader.

Dolus1984 avatar Dolus1984 commented on August 16, 2024

I already saw issue #2
I suspected that it can be done by serialization and deserialization,
Sadly there are unexpected behaviors which may prevent you using such method by users like unexpected shutdown, so your serialized object does not fit with file content if i am right.
It would be good to use AddRange but i believe it does not really fit with your multi-part concept.
I previously used java based app (JDownloader) which was capable to resume multi-part downloading after restarting app.

from downloader.

Toqe avatar Toqe commented on August 16, 2024

I'm not quite sure if I understand your point correctly, but I think events like sudden shutdown could be handled by not only saving the state of a download when stopping it gracefully, but also saving it from time to time. It's also no problem if the saved state is a bit older than the already downloaded file, as the resumed download would only overwrite some already downloaded parts which causes not trouble.

If you really want to be sure that the download on the disk is matching the state of the already downloaded parts, you could write your own version of DownloadToFileSaver, which stores the state to a file placed beside the target file as soon as DataReceived is called. Drawback of this solution would be additional disk throughput, so you may have to throttle the writes of the state to disk.

from downloader.

Dolus1984 avatar Dolus1984 commented on August 16, 2024

You are right, i missed that already downloaded parts will be overwritten.
I properly deserialized AlreadyDownloadedRanges to file and serialized it back, so it resumed much faster than by AddRange request.
Thank you for this suggestion.

from downloader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.