From a83cc0faee83623ed289639308dd3bdd4539696a Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Mon, 25 Mar 2024 14:28:34 -0400 Subject: [PATCH 1/8] always stream 7z out of assembly during client setup task --- SPTInstaller/Installer Tasks/SetupClientTask.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/SPTInstaller/Installer Tasks/SetupClientTask.cs b/SPTInstaller/Installer Tasks/SetupClientTask.cs index 0c2a610..12c7a34 100644 --- a/SPTInstaller/Installer Tasks/SetupClientTask.cs +++ b/SPTInstaller/Installer Tasks/SetupClientTask.cs @@ -25,16 +25,15 @@ public class SetupClientTask : InstallerTaskBase var progress = new Progress((d) => { SetStatus(null, null, (int)Math.Floor(d)); }); + SetStatus("Preparing 7z", "", null, ProgressStyle.Indeterminate); + + if (!FileHelper.StreamAssemblyResourceOut("7z.dll", Path.Join(DownloadCacheHelper.CachePath, "7z.dll"))) + { + return Result.FromError("Failed to prepare 7z"); + } if (_data.PatchNeeded) { - SetStatus("Preparing 7z", "", null, ProgressStyle.Indeterminate); - - if (!FileHelper.StreamAssemblyResourceOut("7z.dll", Path.Join(DownloadCacheHelper.CachePath, "7z.dll"))) - { - return Result.FromError("Failed to prepare 7z"); - } - // extract patcher files SetStatus("Extrating Patcher", "", 0); From c63bfa89ff26e15e4423ea69656af4800ec2b431 Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Mon, 25 Mar 2024 14:40:09 -0400 Subject: [PATCH 2/8] slightly more logging for hashes --- SPTInstaller/Helpers/DownloadCacheHelper.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SPTInstaller/Helpers/DownloadCacheHelper.cs b/SPTInstaller/Helpers/DownloadCacheHelper.cs index b6b318b..533dc7e 100644 --- a/SPTInstaller/Helpers/DownloadCacheHelper.cs +++ b/SPTInstaller/Helpers/DownloadCacheHelper.cs @@ -66,13 +66,16 @@ public static class DownloadCacheHelper if (FileHashHelper.CheckHash(cacheFile, expectedHash)) { fileInCache = cacheFile; + Log.Information("Hashes MATCH"); return true; } + Log.Warning("Hashes DO NOT MATCH"); return false; } - catch + catch(Exception ex) { + Log.Error(ex, "Something went wrong during hashing"); return false; } } From 2c512bae8288f6db812da054d36cb6588da8c45c Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Mon, 25 Mar 2024 14:40:29 -0400 Subject: [PATCH 3/8] add logging to move patcher command --- .../Dialogs/WhyCacheThoughDialog.axaml.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs b/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs index 5e1d86b..4bc46f0 100644 --- a/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs +++ b/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs @@ -63,7 +63,9 @@ public partial class WhyCacheThoughDialog : UserControl if (!downloadsFolder.Exists) { - AdditionalInfo = "Could not get downloads folder :("; + var message = "Could not get downloads folder :("; + Log.Error($"[MV_0] {message}"); + AdditionalInfo = message; AdditionalInfoColor = "red"; _movePatcherState = -1; return; @@ -73,13 +75,15 @@ public partial class WhyCacheThoughDialog : UserControl if (_foundPatcher == null || !_foundPatcher.Exists) { - AdditionalInfo = - "Could not find a patcher file in your downloads folder"; + var message = "Could not find a patcher file in your downloads folder"; + Log.Warning($"[MV_0] {message}"); + AdditionalInfo = message; AdditionalInfoColor = "red"; return; } + Log.Information($"[MV_0] Found patcher for move: {_foundPatcher.Name}"); AdditionalInfo = $"Click again to move the below patcher file to the cache folder\n{_foundPatcher?.Name ?? "-SOMETHING WENT WRONG-"}"; AdditionalInfoColor = "#FFC107"; _movePatcherState = 1; @@ -89,7 +93,9 @@ public partial class WhyCacheThoughDialog : UserControl { var cacheFilePath = Path.Join(DownloadCacheHelper.CachePath, "patcher"); _foundPatcher?.MoveTo(cacheFilePath, true); - AdditionalInfo = "Patch was moved into cache :D"; + var message = "Patcher was moved into cache :D"; + Log.Information($"[MV_1] {message}"); + AdditionalInfo = message; AdditionalInfoColor = "ForestGreen"; } catch (Exception ex) @@ -99,6 +105,9 @@ public partial class WhyCacheThoughDialog : UserControl Log.Error(ex, "Failed to move downloaded patcher file into cache"); } break; + default: + Log.Error("[MV_ ] Move state is broken :("); + break; } } } From b94ed37f05582ed11a5dc163af597dfa8691521b Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Mon, 25 Mar 2024 14:54:23 -0400 Subject: [PATCH 4/8] use correct property to show action button --- SPTInstaller/Views/PreChecksView.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPTInstaller/Views/PreChecksView.axaml b/SPTInstaller/Views/PreChecksView.axaml index ed6af3f..f7aac04 100644 --- a/SPTInstaller/Views/PreChecksView.axaml +++ b/SPTInstaller/Views/PreChecksView.axaml @@ -25,7 +25,7 @@ Details="{Binding SelectedPreCheck.Details}" ActionButtonText="{Binding SelectedPreCheck.ActionButtonText}" ActionCommand="{Binding SelectedPreCheck.ActionButtonCommand}" - ShowAction="{Binding SelectedPreCheck.ActionButtonIsVisible}" + ShowAction="{Binding SelectedPreCheck.ShowActionButton}" BarColor="{Binding SelectedPreCheck.BarColor}" /> From e17441a1a99006124019c4f4e084156c7da69e28 Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Mon, 25 Mar 2024 14:28:34 -0400 Subject: [PATCH 5/8] always stream 7z out of assembly during client setup task --- SPTInstaller/Installer Tasks/SetupClientTask.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/SPTInstaller/Installer Tasks/SetupClientTask.cs b/SPTInstaller/Installer Tasks/SetupClientTask.cs index 0c2a610..12c7a34 100644 --- a/SPTInstaller/Installer Tasks/SetupClientTask.cs +++ b/SPTInstaller/Installer Tasks/SetupClientTask.cs @@ -25,16 +25,15 @@ public class SetupClientTask : InstallerTaskBase var progress = new Progress((d) => { SetStatus(null, null, (int)Math.Floor(d)); }); + SetStatus("Preparing 7z", "", null, ProgressStyle.Indeterminate); + + if (!FileHelper.StreamAssemblyResourceOut("7z.dll", Path.Join(DownloadCacheHelper.CachePath, "7z.dll"))) + { + return Result.FromError("Failed to prepare 7z"); + } if (_data.PatchNeeded) { - SetStatus("Preparing 7z", "", null, ProgressStyle.Indeterminate); - - if (!FileHelper.StreamAssemblyResourceOut("7z.dll", Path.Join(DownloadCacheHelper.CachePath, "7z.dll"))) - { - return Result.FromError("Failed to prepare 7z"); - } - // extract patcher files SetStatus("Extrating Patcher", "", 0); From 7ca0eab4d7e23bcb6eb525a3d16f16a2ce661a8e Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Mon, 25 Mar 2024 14:40:09 -0400 Subject: [PATCH 6/8] slightly more logging for hashes --- SPTInstaller/Helpers/DownloadCacheHelper.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SPTInstaller/Helpers/DownloadCacheHelper.cs b/SPTInstaller/Helpers/DownloadCacheHelper.cs index b6b318b..533dc7e 100644 --- a/SPTInstaller/Helpers/DownloadCacheHelper.cs +++ b/SPTInstaller/Helpers/DownloadCacheHelper.cs @@ -66,13 +66,16 @@ public static class DownloadCacheHelper if (FileHashHelper.CheckHash(cacheFile, expectedHash)) { fileInCache = cacheFile; + Log.Information("Hashes MATCH"); return true; } + Log.Warning("Hashes DO NOT MATCH"); return false; } - catch + catch(Exception ex) { + Log.Error(ex, "Something went wrong during hashing"); return false; } } From 85e8ad99a05a11f84f4dfabcf5159505844db965 Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Mon, 25 Mar 2024 14:40:29 -0400 Subject: [PATCH 7/8] add logging to move patcher command --- .../Dialogs/WhyCacheThoughDialog.axaml.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs b/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs index 5e1d86b..4bc46f0 100644 --- a/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs +++ b/SPTInstaller/CustomControls/Dialogs/WhyCacheThoughDialog.axaml.cs @@ -63,7 +63,9 @@ public partial class WhyCacheThoughDialog : UserControl if (!downloadsFolder.Exists) { - AdditionalInfo = "Could not get downloads folder :("; + var message = "Could not get downloads folder :("; + Log.Error($"[MV_0] {message}"); + AdditionalInfo = message; AdditionalInfoColor = "red"; _movePatcherState = -1; return; @@ -73,13 +75,15 @@ public partial class WhyCacheThoughDialog : UserControl if (_foundPatcher == null || !_foundPatcher.Exists) { - AdditionalInfo = - "Could not find a patcher file in your downloads folder"; + var message = "Could not find a patcher file in your downloads folder"; + Log.Warning($"[MV_0] {message}"); + AdditionalInfo = message; AdditionalInfoColor = "red"; return; } + Log.Information($"[MV_0] Found patcher for move: {_foundPatcher.Name}"); AdditionalInfo = $"Click again to move the below patcher file to the cache folder\n{_foundPatcher?.Name ?? "-SOMETHING WENT WRONG-"}"; AdditionalInfoColor = "#FFC107"; _movePatcherState = 1; @@ -89,7 +93,9 @@ public partial class WhyCacheThoughDialog : UserControl { var cacheFilePath = Path.Join(DownloadCacheHelper.CachePath, "patcher"); _foundPatcher?.MoveTo(cacheFilePath, true); - AdditionalInfo = "Patch was moved into cache :D"; + var message = "Patcher was moved into cache :D"; + Log.Information($"[MV_1] {message}"); + AdditionalInfo = message; AdditionalInfoColor = "ForestGreen"; } catch (Exception ex) @@ -99,6 +105,9 @@ public partial class WhyCacheThoughDialog : UserControl Log.Error(ex, "Failed to move downloaded patcher file into cache"); } break; + default: + Log.Error("[MV_ ] Move state is broken :("); + break; } } } From de4059ca5011b470632b1bc7736c96b5740c8739 Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Mon, 25 Mar 2024 14:54:23 -0400 Subject: [PATCH 8/8] use correct property to show action button --- SPTInstaller/Views/PreChecksView.axaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPTInstaller/Views/PreChecksView.axaml b/SPTInstaller/Views/PreChecksView.axaml index ed6af3f..f7aac04 100644 --- a/SPTInstaller/Views/PreChecksView.axaml +++ b/SPTInstaller/Views/PreChecksView.axaml @@ -25,7 +25,7 @@ Details="{Binding SelectedPreCheck.Details}" ActionButtonText="{Binding SelectedPreCheck.ActionButtonText}" ActionCommand="{Binding SelectedPreCheck.ActionButtonCommand}" - ShowAction="{Binding SelectedPreCheck.ActionButtonIsVisible}" + ShowAction="{Binding SelectedPreCheck.ShowActionButton}" BarColor="{Binding SelectedPreCheck.BarColor}" />