Skip to content

Commit cd466fc

Browse files
committed
Bug fix: Downloaded games were shown as paused after downloading large files
1 parent b9b77c6 commit cd466fc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

gamevault/Helper/Web/HttpClientDownloadWithProgress.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ private void InitResume()
7777
string[] resumeDataToProcess = resumeData.Split(";");
7878
ResumePosition = long.Parse(resumeDataToProcess[0]);
7979
PreResumeSize = long.Parse(resumeDataToProcess[1]);
80-
HttpClient.DefaultRequestHeaders.Range = new RangeHeaderValue(long.Parse(resumeDataToProcess[0]), null);
80+
HttpClient.DefaultRequestHeaders.Range = new RangeHeaderValue(long.Parse(resumeDataToProcess[0]), null);
8181
}
8282
catch { }
8383
}
8484
}
8585

8686
private async Task DownloadFileFromHttpResponseMessage(HttpResponseMessage response)
87-
{
87+
{
8888
try
8989
{
9090
FileName = response.Content.Headers.ContentDisposition.FileName.Replace("\"", "");
@@ -165,10 +165,10 @@ private async Task ProcessContentStream(long currentDownloadSize, Stream content
165165
currentBytesRead += bytesRead;
166166
if ((DateTime.Now - LastTime).TotalMilliseconds > 2000)
167167
{
168-
TriggerProgressChanged(currentDownloadSize, currentBytesRead, fileStream.Position);
169-
LastTime = DateTime.Now;
170168
//Save checkpoints all two seconds in case the app is closed by the user, or hardly crashed
171169
Preferences.Set(AppConfigKey.DownloadProgress, $"{fileStream.Position};{(PreResumeSize == -1 ? currentDownloadSize : PreResumeSize)}", $"{DestinationFolderPath}\\gamevault-metadata");
170+
TriggerProgressChanged(currentDownloadSize, currentBytesRead, fileStream.Position);
171+
LastTime = DateTime.Now;
172172
}
173173
}
174174
while (isMoreToRead);

0 commit comments

Comments
 (0)