Skip to content

Commit 5bf032e

Browse files
committed
Dynamic installation status icon
1 parent 6da9bda commit 5bf032e

File tree

4 files changed

+30
-8
lines changed

4 files changed

+30
-8
lines changed

CollapseLauncher/Classes/InstallManagement/Base/InstallManagerBase.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ protected virtual async ValueTask<int> ConfirmDeltaPatchDialog(DeltaPatchPropert
247247
{
248248
// Set the activity
249249
Status.ActivityStatus = Lang!._GameRepairPage!.Status2!;
250+
Status.ActivityStatusInternet = false;
250251
Status.IsIncludePerFileIndicator = false;
251252
Status.IsProgressAllIndetermined = true;
252253
UpdateStatus();
@@ -256,9 +257,10 @@ protected virtual async ValueTask<int> ConfirmDeltaPatchDialog(DeltaPatchPropert
256257
bool isDownloadNeeded = await _gameRepairTool.StartCheckRoutine()!;
257258
if (isDownloadNeeded)
258259
{
259-
Status.ActivityStatus = Lang._GameRepairPage.Status8!.Replace(": ", "");
260-
ProgressAllSizeCurrent = 0;
261-
ProgressAllCountCurrent = 1;
260+
Status.ActivityStatus = Lang._GameRepairPage.Status8!.Replace(": ", "");
261+
Status.ActivityStatusInternet = false;
262+
ProgressAllSizeCurrent = 0;
263+
ProgressAllCountCurrent = 1;
262264
UpdateStatus();
263265

264266
// If download needed, then start the repair (download) routine
@@ -310,12 +312,13 @@ protected virtual async ValueTask<bool> StartDeltaPatch(IRepairAssetIndex repair
310312

311313
// Get the sum of uncompressed size and
312314
// Set progress count to beginning
313-
ProgressAllSizeTotal = localAssetIndex!.Sum(x => x!.S);
314-
ProgressAllSizeCurrent = 0;
315-
ProgressAllCountCurrent = 1;
315+
ProgressAllSizeTotal = localAssetIndex!.Sum(x => x!.S);
316+
ProgressAllSizeCurrent = 0;
317+
ProgressAllCountCurrent = 1;
316318
Status.IsIncludePerFileIndicator = false;
317319
Status.IsProgressAllIndetermined = true;
318320
Status.ActivityStatus = Lang!._Misc!.ApplyingPatch;
321+
Status.ActivityStatusInternet = false;
319322
UpdateStatus();
320323

321324
// Start the patching process
@@ -722,6 +725,7 @@ private async ValueTask<int> RunPackageVerificationRoutine(GameInstallPackage as
722725
Status.ActivityStatus =
723726
$"{Lang!._Misc!.Verifying}: {string.Format(Lang._Misc.PerFromTo!, ProgressAllCountCurrent,
724727
ProgressAllCountTotal)}";
728+
Status.ActivityStatusInternet = false;
725729
UpdateStatus();
726730

727731
// Run the check and assign to hashLocal variable
@@ -891,6 +895,7 @@ protected virtual async Task StartPackageInstallationInner(List<GameInstallPacka
891895
Status.ActivityStatus =
892896
$"{Lang!._Misc!.Extracting}: {string.Format(Lang._Misc.PerFromTo!, ProgressAllCountCurrent,
893897
ProgressAllCountTotal)}";
898+
Status.ActivityStatusInternet = false;
894899
Status.IsProgressPerFileIndetermined = false;
895900
Status.IsProgressAllIndetermined = false;
896901
UpdateStatus();
@@ -957,6 +962,7 @@ protected virtual async Task StartPackageInstallationInner(List<GameInstallPacka
957962
Status.ActivityStatus = $"{Lang!._Misc!.FinishingUp}: {string.Format(Lang._Misc.PerFromTo!,
958963
ProgressAllCountCurrent,
959964
ProgressAllCountTotal)}";
965+
Status.ActivityStatusInternet = false;
960966
Status.IsProgressPerFileIndetermined = true;
961967
Status.IsProgressAllIndetermined = true;
962968
UpdateStatus();
@@ -1746,6 +1752,7 @@ protected virtual async Task ApplyHDiffMap()
17461752
Status.ActivityStatus =
17471753
$"{Lang._Misc.Patching}: {string.Format(Lang._Misc.PerFromTo, ProgressAllCountTotal,
17481754
ProgressAllCountFound)}";
1755+
Status.ActivityStatusInternet = false;
17491756

17501757
bool isSuccess = false;
17511758

@@ -1922,6 +1929,7 @@ public virtual async Task ApplyHdiffListPatch()
19221929
Status.ActivityStatus =
19231930
$"{Lang._Misc.Patching}: {string.Format(Lang._Misc.PerFromTo, ProgressAllCountTotal,
19241931
ProgressAllCountFound)}";
1932+
Status.ActivityStatusInternet = false;
19251933

19261934
string patchBasePath = Path.Combine(GamePath, ConverterTool.NormalizePath(entry.remoteName));
19271935
string sourceBasePath = GetBasePersistentDirectory(GamePath, entry.remoteName);
@@ -3267,6 +3275,7 @@ private async ValueTask RunPackageDownloadRoutine(Http httpClient,
32673275
Status.ActivityStatus =
32683276
$"{Lang._Misc.Downloading}: {string.Format(Lang._Misc.PerFromTo, ProgressAllCountCurrent,
32693277
ProgressAllCountTotal)}";
3278+
Status.ActivityStatusInternet = true;
32703279
LogWriteLine($"Downloading package URL {ProgressAllCountCurrent}/{ProgressAllCountTotal} ({ConverterTool.SummarizeSizeSimple(package.Size)}): {package.URL}");
32713280

32723281
// If the file exist or package size is unmatched,
@@ -3317,6 +3326,7 @@ await RunDownloadTask(
33173326
Status.ActivityStatus =
33183327
$"{Lang._Misc.Merging}: {string.Format(Lang._Misc.PerFromTo, ProgressAllCountCurrent,
33193328
ProgressAllCountTotal)}";
3329+
Status.ActivityStatusInternet = false;
33203330
UpdateStatus();
33213331

33223332
// Check if the merge chunk is enabled and the download could perform multisession,

CollapseLauncher/Classes/Interfaces/Class/Structs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ internal class TotalPerFileProgress
3434
internal class TotalPerFileStatus
3535
{
3636
public string ActivityStatus { get; set; }
37+
public bool ActivityStatusInternet { get; set; }
3738

3839
public string ActivityAll { get; set; }
3940
public bool IsProgressAllIndetermined { get; set; }

CollapseLauncher/XAMLs/MainApp/Pages/HomePage.GameManagement.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,9 @@ private void GameInstall_StatusChanged_Inner(TotalPerFileStatus e)
465465

466466
progressRing.IsIndeterminate = e.IsProgressAllIndetermined;
467467
progressRingPerFile.IsIndeterminate = e.IsProgressPerFileIndetermined;
468+
469+
ProgressStatusIconDisk.Visibility = e.ActivityStatusInternet ? Visibility.Collapsed : Visibility.Visible;
470+
ProgressStatusIconInternet.Visibility = e.ActivityStatusInternet ? Visibility.Visible : Visibility.Collapsed;
468471
}
469472

470473
private void GameInstall_ProgressChanged(object sender, TotalPerFileProgress e)
@@ -905,4 +908,4 @@ private void CancelInstallationDownload()
905908
CurrentGameProperty.GameInstall.CancelRoutine();
906909
}
907910
#endregion
908-
}
911+
}

CollapseLauncher/XAMLs/MainApp/Pages/HomePage.xaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,9 +1355,17 @@
13551355
<ColumnDefinition Width="Auto" />
13561356
<ColumnDefinition MaxWidth="160" />
13571357
</Grid.ColumnDefinitions>
1358-
<FontIcon FontFamily="{ThemeResource FontAwesome}"
1358+
<FontIcon x:Name="ProgressStatusIconDisk"
1359+
Grid.Column="0"
1360+
FontFamily="{ThemeResource FontAwesome}"
13591361
FontSize="12"
13601362
Glyph="" />
1363+
<FontIcon x:Name="ProgressStatusIconInternet"
1364+
Grid.Column="0"
1365+
Visibility="Collapsed"
1366+
FontFamily="{ThemeResource FontAwesomeSolid}"
1367+
FontSize="12"
1368+
Glyph="" />
13611369
<TextBlock x:Name="ProgressStatusFooter"
13621370
Grid.Column="1"
13631371
FontSize="10"

0 commit comments

Comments
 (0)