Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for settings not reloading without restarting the app #306

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/helpers/ServiceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public static class ServiceHelper
public static FirmwareService FirmwareService { get; private set; }
public static ArchiveService ArchiveService { get; private set; }
public static AssetsService AssetsService { get; private set; }
public static EventHandler<StatusUpdatedEventArgs> StatusUpdated { get; private set; }
public static EventHandler<UpdateProcessCompleteEventArgs> UpdateProcessComplete { get; private set; }

private static bool isInitialized;

Expand Down Expand Up @@ -40,11 +42,13 @@ public static void Initialize(string path, EventHandler<StatusUpdatedEventArgs>
FirmwareService.StatusUpdated += statusUpdated;
CoresService.StatusUpdated += statusUpdated;
ArchiveService.StatusUpdated += statusUpdated;
StatusUpdated = statusUpdated;
}

if (updateProcessComplete != null)
{
CoresService.UpdateProcessComplete += updateProcessComplete;
UpdateProcessComplete = updateProcessComplete;
}
}
}
Expand All @@ -56,5 +60,6 @@ public static void ReloadSettings()
ArchiveService = new ArchiveService(SettingsService.GetConfig().archives,
SettingsService.GetConfig().crc_check, SettingsService.GetConfig().use_custom_archive);
CoresService = new CoresService(UpdateDirectory, SettingsService, ArchiveService, AssetsService);
CoresService.StatusUpdated += StatusUpdated;
}
}
1 change: 1 addition & 0 deletions src/partials/Program.Menus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ private static void DisplayMenu(CoreUpdaterService coreUpdaterService)
SettingsMenu();
// Is reloading the settings file necessary?
ServiceHelper.ReloadSettings();
coreUpdaterService.ReloadSettings();
})
.Add("Exit", ConsoleMenu.Close);

Expand Down
10 changes: 8 additions & 2 deletions src/services/CoreUpdaterService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public class CoreUpdaterService : BaseProcess
private readonly string installPath;
private readonly List<Core> cores;
private readonly FirmwareService firmwareService;
private readonly SettingsService settingsService;
private readonly CoresService coresService;
private SettingsService settingsService;
private CoresService coresService;

public CoreUpdaterService(
string path,
Expand Down Expand Up @@ -356,4 +356,10 @@ public void DeleteCore(Core core, bool force = false, bool nuke = false)
this.coresService.Uninstall(core.identifier, core.platform_id, nuke);
}
}

public void ReloadSettings()
{
this.settingsService = ServiceHelper.SettingsService;;
this.coresService = ServiceHelper.CoresService;
}
}
Loading