From c09aa93918712aebba0cde11a641236a40361847 Mon Sep 17 00:00:00 2001 From: sharpjd <59419827+sharpjd@users.noreply.github.com> Date: Wed, 1 May 2024 00:15:19 -0400 Subject: [PATCH] fixed bug: PendingAddToRegistry and SeenInRegistry are both true but because of the former, it still tries to add it (causing an exception) --- GPUPrefSwitcher/Switcher.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GPUPrefSwitcher/Switcher.cs b/GPUPrefSwitcher/Switcher.cs index 9c3055d..59f28fc 100644 --- a/GPUPrefSwitcher/Switcher.cs +++ b/GPUPrefSwitcher/Switcher.cs @@ -230,10 +230,11 @@ private static async Task RunUpdateLogic() WriteRegistryToXML(); } - WriteXMLToRegistry(currentPowerLineStatus); - + //This NEEDS to come before (XML -> Registry) and after (Registry -> XML) (XML -> Registry depends on this) UpdateSeenInRegistryStatuses(); //sets the SeenInRegistry entry accordingly + WriteXMLToRegistry(currentPowerLineStatus); + AppEntrySaveHandler appEntrySaveHandler = await appEntryLibrarian.Borrow(); Task swaps = BeginFileSwapLogic(currentPowerLineStatus, appEntrySaveHandler.CurrentAppEntries); appEntryLibrarian.Return(appEntrySaveHandler); @@ -491,7 +492,7 @@ internal static void WriteXMLToRegistry(PowerLineStatus powerLineStatus) foreach (AppEntry appEntry in appEntries) { - if (appEntry.PendingAddToRegistry) + if (appEntry.PendingAddToRegistry && !appEntry.SeenInRegistry) { Logger.inst.Log($"Pending registry add detected: {appEntry.AppPath}");