PonySFM / Workshop

Mod manager application for PonySFM
https://workshop.ponysfm.com
GNU General Public License v3.0
9 stars 1 forks source link

Download progress does not affect installation progressbar #39

Closed gsass1 closed 7 years ago

gsass1 commented 7 years ago

This boils down to the code in https://github.com/Nuke928/PonySFM-Workshop/blob/master/CoreLib/Impl/PonySFMAPIConnector.cs#L60:

public async Task DownloadRevisionZIP(int id, string filepath, IProgress<int> progress)
{
        var webClient = new CookedWebClient();
        webClient.Headers.Add("user-agent", "PSFM_ModManager-" + ModManager.Version);

        webClient.DownloadProgressChanged += delegate (object sender, DownloadProgressChangedEventArgs e)
        {
                progress.Report(e.ProgressPercentage);
        };

        await webClient.DownloadFileTaskAsync(new Uri(string.Format("{0}/rev/{1}/internal_download_redirect", _baseUrl, id)),
        filepath);
}

Somehow, e.ProgressPercentage is always 0.

dd86k commented 7 years ago

On the longer run, a "master task" (object/method) could be written that so invokes smaller tasks (download/install) which would help on the notification related task

gsass1 commented 7 years ago

The issue stems from the server not sending total file size at beginning of download. Not a client issue thus.

dd86k commented 7 years ago

oh lol