diff --git a/BattleNetPrefill/TactProductHandler.cs b/BattleNetPrefill/TactProductHandler.cs index c8fcd600..c45d6533 100644 --- a/BattleNetPrefill/TactProductHandler.cs +++ b/BattleNetPrefill/TactProductHandler.cs @@ -88,12 +88,16 @@ await Task.WhenAll(archiveIndexHandler.BuildArchiveIndexesAsync(cdnConfig, ctx), _ansiConsole.LogMarkupLine("Retrieved product metadata", metadataTimer); // Actually start the download of any deferred requests - var downloadSuccess = await cdnRequestManager.DownloadQueuedRequestsAsync(); - if (downloadSuccess) + var downloadSuccessful = await cdnRequestManager.DownloadQueuedRequestsAsync(_prefillSummaryResult); + if (downloadSuccessful) { MarkDownloadAsSuccessful(product, targetVersion.Value); _prefillSummaryResult.Updated++; } + else + { + _prefillSummaryResult.FailedApps++; + } if (!AppConfig.CompareAgainstRealRequests) { diff --git a/BattleNetPrefill/Web/CdnRequestManager.cs b/BattleNetPrefill/Web/CdnRequestManager.cs index eed66e5e..fb840f01 100644 --- a/BattleNetPrefill/Web/CdnRequestManager.cs +++ b/BattleNetPrefill/Web/CdnRequestManager.cs @@ -100,7 +100,7 @@ public void QueueRequest(RootFolder rootPath, in MD5Hash hash, in long? startByt /// false will be returned /// /// True if all downloads succeeded. False if downloads failed 3 times. - public async Task DownloadQueuedRequestsAsync() + public async Task DownloadQueuedRequestsAsync(PrefillSummaryResult prefillSummaryResult) { // Combining requests to improve download performance var coalescedRequests = RequestUtils.CoalesceRequests(_queuedRequests, true); @@ -144,6 +144,8 @@ await _ansiConsole.CreateSpectreProgress(AppConfig.TransferSpeedUnit).StartAsync // Logging some metrics about the download _ansiConsole.LogMarkupLine($"Finished in {LightYellow(downloadTimer.FormatElapsedString())} - {Magenta(totalDownloadSize.CalculateBitrate(downloadTimer))}"); _ansiConsole.WriteLine(); + //TODO I don't like the fact that I'm passing this down into this method + prefillSummaryResult.TotalBytesTransferred += totalDownloadSize; return true; }