looked at unity's AsyncOperation.progress which is apparently terribly broken so the download ProgressBar now ignores negative progress changes.

This commit is contained in:
2018-09-02 16:16:29 +02:00
parent d94cb5979e
commit b03cc746d7
2 changed files with 23 additions and 20 deletions

View File

@@ -208,8 +208,6 @@ namespace RothenburgAR.Updater
private void UpdateMedia(Exhibit exhibit)
{
//TODO check existing file for creation/alteration date to see if download is necessary
var mediaIDs = exhibit.Pois.Select(p => p.MediaId).Except(new List<string> { null }).ToList();
foreach (var mediaId in mediaIDs)
@@ -217,7 +215,7 @@ namespace RothenburgAR.Updater
var path = PathHelper.CombinePaths(PathHelper.MediaPath, mediaId);
var filepath = Path.Combine(path, "media.zip");
//TODO cancel download if unnecessary
//TODO cancel download if unnecessary, how to check if unnecessary?
if (File.Exists(filepath)) continue;
// create file and dir if nonexistent
@@ -286,7 +284,12 @@ namespace RothenburgAR.Updater
downloadProgress /= httpHandlers.Count;
ProgressBar.value = downloadProgress;
// operation.progress is bugged and goes all over the place:
// jumps from 0 to 1 and back despite not being done
// steadily increases from 0,5 to 0,99 and resets to 0,5 multiple times (5-15x) during a single download
// update progress bar and ignore all negative changes
ProgressBar.value = ProgressBar.value < downloadProgress ? downloadProgress : ProgressBar.value;
}
// Continue to Main Scene after all downloads are done and this.afterDownloadWaitTime seconds have passed without any new downloads triggering.