Skip to content

Commit

Permalink
Config file fixe
Browse files Browse the repository at this point in the history
  • Loading branch information
RetroDriven committed May 12, 2024
1 parent d158b0d commit c8c87b8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/Updater/helpers/ServiceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ public static class ServiceHelper
public static string UpdateDirectory { get; private set; } // move off this
public static string TempDirectory { get; private set; }
public static CoresService CoresService { get; private set; }
public static SettingsService SettingsService { get; private set ;}
public static SettingsService SettingsService { get; private set; }
public static PlatformImagePacksService PlatformImagePacksService { get; private set; }
public static FirmwareService FirmwareService { get; private set; }
public static ArchiveService ArchiveService { get; private set; }
public static AssetsService AssetsService { get; private set; }

private static bool isInitialized;

public static void Initialize(string path, EventHandler<StatusUpdatedEventArgs> statusUpdated = null,
EventHandler<UpdateProcessCompleteEventArgs> updateProcessComplete = null)
public static void Initialize(string path, string config_path, EventHandler<StatusUpdatedEventArgs> statusUpdated = null,
EventHandler<UpdateProcessCompleteEventArgs> updateProcessComplete = null, bool forceReload = false)
{
if (!isInitialized)
if (!isInitialized || forceReload)
{
isInitialized = true;
UpdateDirectory = path;
SettingsService = new SettingsService(path);
SettingsService = new SettingsService(config_path);
ArchiveService = new ArchiveService(SettingsService.GetConfig().archives,
SettingsService.GetConfig().crc_check, SettingsService.GetConfig().use_custom_archive);
TempDirectory = SettingsService.GetConfig().temp_directory ?? UpdateDirectory;
Expand Down Expand Up @@ -52,5 +52,9 @@ public static void Initialize(string path, EventHandler<StatusUpdatedEventArgs>
public static void ReloadSettings()
{
SettingsService = new SettingsService(UpdateDirectory, CoresService.Cores);
//reload the archive service, in case that setting has changed
ArchiveService = new ArchiveService(SettingsService.GetConfig().archives,
SettingsService.GetConfig().crc_check, SettingsService.GetConfig().use_custom_archive);
CoresService = new CoresService(UpdateDirectory, SettingsService, ArchiveService, AssetsService);
}
}

0 comments on commit c8c87b8

Please sign in to comment.