Skip to content

Commit cb8108e

Browse files
committed
Fix Preload and Patch asset numbers on display
Welp, actually still not fix the exact number on display (due to UI dependency). But at least the number isn't too big now.
1 parent d3a4f48 commit cb8108e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

CollapseLauncher/Classes/InstallManagement/Base/InstallManagerBase.SophonPatch.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,14 @@ protected virtual async Task StartAlterSophonPatch(HttpClient httpClient,
414414
Dictionary<string, int> downloadedPatchHashSet = new();
415415
Lock dictionaryLock = new();
416416

417-
IEnumerable<Tuple<SophonPatchAsset, Dictionary<string, int>>> pipelineDownloadEnumerable = patchAssets
417+
List<Tuple<SophonPatchAsset, Dictionary<string, int>>> pipelineDownloadEnumerable = patchAssets
418418
.EnsureOnlyGetDedupPatchAssets()
419-
.Select(x => new Tuple<SophonPatchAsset, Dictionary<string, int>>(x, downloadedPatchHashSet));
419+
.Select(x => new Tuple<SophonPatchAsset, Dictionary<string, int>>(x, downloadedPatchHashSet))
420+
.ToList();
420421

421-
IEnumerable<Tuple<SophonPatchAsset, Dictionary<string, int>>> pipelinePatchEnumerable = patchAssets
422-
.Select(x => new Tuple<SophonPatchAsset, Dictionary<string, int>>(x, downloadedPatchHashSet));
422+
List<Tuple<SophonPatchAsset, Dictionary<string, int>>> pipelinePatchEnumerable = patchAssets
423+
.Select(x => new Tuple<SophonPatchAsset, Dictionary<string, int>>(x, downloadedPatchHashSet))
424+
.ToList();
423425

424426
ParallelOptions parallelOptions = new()
425427
{
@@ -441,7 +443,6 @@ protected virtual async Task StartAlterSophonPatch(HttpClient httpClient,
441443

442444
// Get download counts
443445
int downloadCountTotalAssetRemote = patchAssets.Count;
444-
int downloadCountPatchOnlyRemote = patchManifestInfoPairs.Sum(x => x.ChunksInfo.ChunksCount);
445446

446447
// Ensure disk space sufficiency
447448
await EnsureDiskSpaceSufficiencyAsync(downloadSizePatchOnlyRemote,
@@ -470,8 +471,8 @@ await EnsureDiskSpaceSufficiencyAsync(downloadSizePatchOnlyRemote,
470471
token);
471472

472473
// Assign local download progress
473-
ProgressAllCountCurrent = 1;
474-
ProgressAllCountTotal = downloadCountPatchOnlyRemote;
474+
ProgressAllCountCurrent = 0;
475+
ProgressAllCountTotal = pipelineDownloadEnumerable.Count;
475476
ProgressPerFileSizeCurrent = 0;
476477
ProgressPerFileSizeTotal = downloadSizePatchOnlyRemote;
477478
ProgressAllSizeCurrent = 0;
@@ -488,7 +489,7 @@ await EnsureDiskSpaceSufficiencyAsync(downloadSizePatchOnlyRemote,
488489
}
489490

490491
// If it's not a preload mode (patch mode), then execute the patch pipeline as well
491-
ProgressAllCountCurrent = 1;
492+
ProgressAllCountCurrent = 0;
492493
ProgressAllCountTotal = downloadCountTotalAssetRemote;
493494
ProgressPerFileSizeCurrent = 0;
494495
ProgressPerFileSizeTotal = downloadSizePatchOnlyRemote;

0 commit comments

Comments
 (0)