From 90a60a7e4886e57cd74f04d49f7b671ba60df071 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Thu, 30 Nov 2023 20:52:09 +0200 Subject: [PATCH] Better interface splitting --- ...{DialogUIProvider.cs => DialogProvider.cs} | 12 +-- .../Adapters/LauncherStateProvider.cs | 73 +++++++++++++++ ...der.cs => LoadOrderPersistenceProvider.cs} | 4 +- ...rProvider.cs => LoadOrderStateProvider.cs} | 59 +----------- ...nUIProvider.cs => NotificationProvider.cs} | 6 +- .../AllocationException.cs | 8 -- .../Bindings.LauncherManager.cs | 16 ++-- .../LauncherManagerHandlerNative.cs | 12 ++- .../External/CallbackLauncherProvider.cs | 33 ------- .../External/CallbackLauncherStateProvider.cs | 25 ++++++ ...> CallbackLoadOrderPersistenceProvider.cs} | 6 +- .../CallbackLoadOrderStateProvider.cs | 24 +++++ .../External/IDialogUIProvider.cs | 11 --- ...rProvider.cs => ILauncherStateProvider.cs} | 6 +- .../External/ILoadOrderPersistenceProvider.cs | 18 ++++ .../External/ILoadOrderProvider.cs | 9 -- .../External/ILoadOrderStateProvider.cs | 26 ++++++ .../External/INotificationUIProvider.cs | 8 -- .../CallbackDialogProvider.cs} | 6 +- .../CallbackNotificationProvider.cs} | 6 +- .../External/UI/IDialogProvider.cs | 19 ++++ .../External/UI/INotificationProvider.cs | 15 ++++ .../IModuleViewModelProvider.cs | 0 .../LauncherManagerHandler.Callbacks.cs | 20 ++--- .../LauncherManagerHandler.cs | 28 +++--- .../HandlerTests.cs | 90 ++++++++++--------- 26 files changed, 318 insertions(+), 222 deletions(-) rename src/Bannerlord.LauncherManager.Native/Adapters/{DialogUIProvider.cs => DialogProvider.cs} (83%) create mode 100644 src/Bannerlord.LauncherManager.Native/Adapters/LauncherStateProvider.cs rename src/Bannerlord.LauncherManager.Native/Adapters/{LoadOrderProvider.cs => LoadOrderPersistenceProvider.cs} (86%) rename src/Bannerlord.LauncherManager.Native/Adapters/{LauncherProvider.cs => LoadOrderStateProvider.cs} (54%) rename src/Bannerlord.LauncherManager.Native/Adapters/{NotificationUIProvider.cs => NotificationProvider.cs} (83%) delete mode 100644 src/Bannerlord.LauncherManager.Native/AllocationException.cs delete mode 100644 src/Bannerlord.LauncherManager/External/CallbackLauncherProvider.cs create mode 100644 src/Bannerlord.LauncherManager/External/CallbackLauncherStateProvider.cs rename src/Bannerlord.LauncherManager/External/{CallbackLoadOrderProvider.cs => CallbackLoadOrderPersistenceProvider.cs} (61%) create mode 100644 src/Bannerlord.LauncherManager/External/CallbackLoadOrderStateProvider.cs delete mode 100644 src/Bannerlord.LauncherManager/External/IDialogUIProvider.cs rename src/Bannerlord.LauncherManager/External/{ILauncherProvider.cs => ILauncherStateProvider.cs} (56%) create mode 100644 src/Bannerlord.LauncherManager/External/ILoadOrderPersistenceProvider.cs delete mode 100644 src/Bannerlord.LauncherManager/External/ILoadOrderProvider.cs create mode 100644 src/Bannerlord.LauncherManager/External/ILoadOrderStateProvider.cs delete mode 100644 src/Bannerlord.LauncherManager/External/INotificationUIProvider.cs rename src/Bannerlord.LauncherManager/External/{CallbackDialogUIProvider.cs => UI/CallbackDialogProvider.cs} (65%) rename src/Bannerlord.LauncherManager/External/{CallbackNotificationUIProvider.cs => UI/CallbackNotificationProvider.cs} (60%) create mode 100644 src/Bannerlord.LauncherManager/External/UI/IDialogProvider.cs create mode 100644 src/Bannerlord.LauncherManager/External/UI/INotificationProvider.cs rename src/Bannerlord.LauncherManager/{External => }/IModuleViewModelProvider.cs (100%) diff --git a/src/Bannerlord.LauncherManager.Native/Adapters/DialogUIProvider.cs b/src/Bannerlord.LauncherManager.Native/Adapters/DialogProvider.cs similarity index 83% rename from src/Bannerlord.LauncherManager.Native/Adapters/DialogUIProvider.cs rename to src/Bannerlord.LauncherManager.Native/Adapters/DialogProvider.cs index 0e48afc..02ff92a 100644 --- a/src/Bannerlord.LauncherManager.Native/Adapters/DialogUIProvider.cs +++ b/src/Bannerlord.LauncherManager.Native/Adapters/DialogProvider.cs @@ -1,4 +1,4 @@ -using Bannerlord.LauncherManager.External; +using Bannerlord.LauncherManager.External.UI; using Bannerlord.LauncherManager.Models; using BUTR.NativeAOT.Shared; @@ -10,12 +10,12 @@ namespace Bannerlord.LauncherManager.Native.Adapters; -internal sealed unsafe class DialogUIProvider : IDialogUIProvider +internal sealed unsafe class DialogProvider : IDialogProvider { private readonly param_ptr* _pOwner; private readonly N_SendDialogDelegate _sendDialog; - public DialogUIProvider(param_ptr* pOwner, N_SendDialogDelegate sendDialog) + public DialogProvider(param_ptr* pOwner, N_SendDialogDelegate sendDialog) { _pOwner = pOwner; _sendDialog = sendDialog; @@ -31,9 +31,9 @@ private void SendDialogNative(ReadOnlySpan type, ReadOnlySpan title, [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })] static void Callback(param_ptr* p_ptr, param_string* p_result) { - Logger.LogInput($"{nameof(SendDialog)}_{nameof(Callback)}"); + Logger.LogInput($"{nameof(SendDialogNative)}_{nameof(Callback)}"); var result = new string(param_string.ToSpan(p_result)); - Logger.LogOutput(result, $"{nameof(SendDialog)}_{nameof(Callback)}"); + Logger.LogOutput(result, $"{nameof(SendDialogNative)}_{nameof(Callback)}"); var handle = GCHandle.FromIntPtr(new IntPtr(p_ptr)); try @@ -43,7 +43,7 @@ static void Callback(param_ptr* p_ptr, param_string* p_result) } catch (Exception e) { - Logger.LogException(e, $"{nameof(SendDialog)}_{nameof(Callback)}"); + Logger.LogException(e, $"{nameof(SendDialogNative)}_{nameof(Callback)}"); } finally { diff --git a/src/Bannerlord.LauncherManager.Native/Adapters/LauncherStateProvider.cs b/src/Bannerlord.LauncherManager.Native/Adapters/LauncherStateProvider.cs new file mode 100644 index 0000000..64dc963 --- /dev/null +++ b/src/Bannerlord.LauncherManager.Native/Adapters/LauncherStateProvider.cs @@ -0,0 +1,73 @@ +using Bannerlord.LauncherManager.External; +using Bannerlord.LauncherManager.Models; + +using BUTR.NativeAOT.Shared; + +using System; +using System.Collections.Generic; + +namespace Bannerlord.LauncherManager.Native.Adapters; + +internal sealed unsafe class LauncherStateProvider : ILauncherStateProvider +{ + private readonly param_ptr* _pOwner; + private readonly N_SetGameParametersDelegate _setGameParameters; + private readonly N_GetOptions _getOptions; + private readonly N_GetState _getState; + + public LauncherStateProvider( + param_ptr* pOwner, + N_SetGameParametersDelegate setGameParameters, + N_GetOptions getOptions, + N_GetState getState) + { + _pOwner = pOwner; + _setGameParameters = setGameParameters; + _getOptions = getOptions; + _getState = getState; + } + + public void SetGameParameters(string executable, IReadOnlyList gameParameters) => SetGameParametersNative(executable, gameParameters); + public LauncherOptions GetOptions() => GetOptionsNative(); + public LauncherState GetState() => GetStateNative(); + + private void SetGameParametersNative(ReadOnlySpan executable, IReadOnlyList gameParameters) + { + Logger.LogInput(); + + fixed (char* pExecutable = executable) + fixed (char* pGameParameters = BUTR.NativeAOT.Shared.Utils.SerializeJson(gameParameters, Bindings.CustomSourceGenerationContext.IReadOnlyListString)) + { + Logger.LogPinned(pExecutable, pGameParameters); + + using var result = SafeStructMallocHandle.Create(_setGameParameters(_pOwner, (param_string*) pExecutable, (param_json*) pGameParameters), true); + result.ValueAsVoid(); + } + + Logger.LogOutput(); + } + + private LauncherOptions GetOptionsNative() + { + Logger.LogInput(); + + using var result = SafeStructMallocHandle.Create(_getOptions(_pOwner), true); + if (result.IsNull) return LauncherOptions.Empty; + + var returnResult = result.ValueAsJson(Bindings.CustomSourceGenerationContext.LauncherOptions)!; + Logger.LogOutput(returnResult); + return returnResult; + } + + private LauncherState GetStateNative() + { + Logger.LogInput(); + + using var result = SafeStructMallocHandle.Create(_getState(_pOwner), true); + if (result.IsNull) return LauncherState.Empty; + + var returnResult = result.ValueAsJson(Bindings.CustomSourceGenerationContext.LauncherState)!; + Logger.LogOutput(returnResult); + return returnResult; + } +} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager.Native/Adapters/LoadOrderProvider.cs b/src/Bannerlord.LauncherManager.Native/Adapters/LoadOrderPersistenceProvider.cs similarity index 86% rename from src/Bannerlord.LauncherManager.Native/Adapters/LoadOrderProvider.cs rename to src/Bannerlord.LauncherManager.Native/Adapters/LoadOrderPersistenceProvider.cs index 027f4d1..9dd9eb4 100644 --- a/src/Bannerlord.LauncherManager.Native/Adapters/LoadOrderProvider.cs +++ b/src/Bannerlord.LauncherManager.Native/Adapters/LoadOrderPersistenceProvider.cs @@ -5,13 +5,13 @@ namespace Bannerlord.LauncherManager.Native.Adapters; -internal sealed unsafe class LoadOrderProvider : ILoadOrderProvider +internal sealed unsafe class LoadOrderPersistenceProvider : ILoadOrderPersistenceProvider { private readonly param_ptr* _pOwner; private readonly N_GetLoadOrderDelegate _getLoadOrder; private readonly N_SetLoadOrderDelegate _setLoadOrder; - public LoadOrderProvider(param_ptr* pOwner, N_GetLoadOrderDelegate getLoadOrder, N_SetLoadOrderDelegate setLoadOrder) + public LoadOrderPersistenceProvider(param_ptr* pOwner, N_GetLoadOrderDelegate getLoadOrder, N_SetLoadOrderDelegate setLoadOrder) { _pOwner = pOwner; _getLoadOrder = getLoadOrder; diff --git a/src/Bannerlord.LauncherManager.Native/Adapters/LauncherProvider.cs b/src/Bannerlord.LauncherManager.Native/Adapters/LoadOrderStateProvider.cs similarity index 54% rename from src/Bannerlord.LauncherManager.Native/Adapters/LauncherProvider.cs rename to src/Bannerlord.LauncherManager.Native/Adapters/LoadOrderStateProvider.cs index da125db..9f33c97 100644 --- a/src/Bannerlord.LauncherManager.Native/Adapters/LauncherProvider.cs +++ b/src/Bannerlord.LauncherManager.Native/Adapters/LoadOrderStateProvider.cs @@ -1,65 +1,38 @@ using Bannerlord.LauncherManager.External; +using Bannerlord.LauncherManager.External.UI; using Bannerlord.LauncherManager.Models; using Bannerlord.LauncherManager.Native.Models; using BUTR.NativeAOT.Shared; -using System; using System.Collections.Generic; using System.Linq; namespace Bannerlord.LauncherManager.Native.Adapters; -internal sealed unsafe class LauncherProvider : ILauncherProvider +internal sealed unsafe class LoadOrderStateProvider : ILoadOrderStateProvider { private readonly param_ptr* _pOwner; - private readonly N_SetGameParametersDelegate _setGameParameters; private readonly N_GetAllModuleViewModels _getAllModuleViewModels; private readonly N_GetModuleViewModels _getModuleViewModels; private readonly N_SetModuleViewModels _setModuleViewModels; - private readonly N_GetOptions _getOptions; - private readonly N_GetState _getState; - public LauncherProvider( + public LoadOrderStateProvider( param_ptr* pOwner, - N_SetGameParametersDelegate setGameParameters, N_GetAllModuleViewModels getAllModuleViewModels, N_GetModuleViewModels getModuleViewModels, - N_SetModuleViewModels setModuleViewModels, - N_GetOptions getOptions, - N_GetState getState) + N_SetModuleViewModels setModuleViewModels) { _pOwner = pOwner; - _setGameParameters = setGameParameters; _getAllModuleViewModels = getAllModuleViewModels; _getModuleViewModels = getModuleViewModels; _setModuleViewModels = setModuleViewModels; - _getOptions = getOptions; - _getState = getState; } - public void SetGameParameters(string executable, IReadOnlyList gameParameters) => SetGameParametersNative(executable, gameParameters); public IModuleViewModel[]? GetAllModuleViewModels() => GetAllModuleViewModelsNative(); public IModuleViewModel[]? GetModuleViewModels() => GetModuleViewModelsNative(); public void SetModuleViewModels(IReadOnlyList moduleViewModels) => SetModuleViewModelsNative(moduleViewModels); - public LauncherOptions GetOptions() => GetOptionsNative(); - public LauncherState GetState() => GetStateNative(); - private void SetGameParametersNative(ReadOnlySpan executable, IReadOnlyList gameParameters) - { - Logger.LogInput(); - - fixed (char* pExecutable = executable) - fixed (char* pGameParameters = BUTR.NativeAOT.Shared.Utils.SerializeJson(gameParameters, Bindings.CustomSourceGenerationContext.IReadOnlyListString)) - { - Logger.LogPinned(pExecutable, pGameParameters); - - using var result = SafeStructMallocHandle.Create(_setGameParameters(_pOwner, (param_string*) pExecutable, (param_json*) pGameParameters), true); - result.ValueAsVoid(); - } - - Logger.LogOutput(); - } private IModuleViewModel[]? GetAllModuleViewModelsNative() { @@ -98,28 +71,4 @@ private void SetModuleViewModelsNative(IReadOnlyList moduleVie } Logger.LogOutput(); } - - private LauncherOptions GetOptionsNative() - { - Logger.LogInput(); - - using var result = SafeStructMallocHandle.Create(_getOptions(_pOwner), true); - if (result.IsNull) return LauncherOptions.Empty; - - var returnResult = result.ValueAsJson(Bindings.CustomSourceGenerationContext.LauncherOptions)!; - Logger.LogOutput(returnResult); - return returnResult; - } - - private LauncherState GetStateNative() - { - Logger.LogInput(); - - using var result = SafeStructMallocHandle.Create(_getState(_pOwner), true); - if (result.IsNull) return LauncherState.Empty; - - var returnResult = result.ValueAsJson(Bindings.CustomSourceGenerationContext.LauncherState)!; - Logger.LogOutput(returnResult); - return returnResult; - } } \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager.Native/Adapters/NotificationUIProvider.cs b/src/Bannerlord.LauncherManager.Native/Adapters/NotificationProvider.cs similarity index 83% rename from src/Bannerlord.LauncherManager.Native/Adapters/NotificationUIProvider.cs rename to src/Bannerlord.LauncherManager.Native/Adapters/NotificationProvider.cs index cb0552b..ceb99a2 100644 --- a/src/Bannerlord.LauncherManager.Native/Adapters/NotificationUIProvider.cs +++ b/src/Bannerlord.LauncherManager.Native/Adapters/NotificationProvider.cs @@ -1,4 +1,4 @@ -using Bannerlord.LauncherManager.External; +using Bannerlord.LauncherManager.External.UI; using Bannerlord.LauncherManager.Models; using BUTR.NativeAOT.Shared; @@ -7,12 +7,12 @@ namespace Bannerlord.LauncherManager.Native.Adapters; -internal sealed unsafe class NotificationUIProvider : INotificationUIProvider +internal sealed unsafe class NotificationProvider : INotificationProvider { private readonly param_ptr* _pOwner; private readonly N_SendNotificationDelegate _sendNotification; - public NotificationUIProvider(param_ptr* pOwner, N_SendNotificationDelegate sendNotification) + public NotificationProvider(param_ptr* pOwner, N_SendNotificationDelegate sendNotification) { _pOwner = pOwner; _sendNotification = sendNotification; diff --git a/src/Bannerlord.LauncherManager.Native/AllocationException.cs b/src/Bannerlord.LauncherManager.Native/AllocationException.cs deleted file mode 100644 index e447d6c..0000000 --- a/src/Bannerlord.LauncherManager.Native/AllocationException.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Bannerlord.LauncherManager.Native; - -public class AllocationException : Exception -{ - public AllocationException(string message) : base(message) { } -} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager.Native/Bindings.LauncherManager.cs b/src/Bannerlord.LauncherManager.Native/Bindings.LauncherManager.cs index f4bcfa0..9caf964 100644 --- a/src/Bannerlord.LauncherManager.Native/Bindings.LauncherManager.cs +++ b/src/Bannerlord.LauncherManager.Native/Bindings.LauncherManager.cs @@ -39,7 +39,7 @@ public static unsafe partial class Bindings try { var launcherManager = new LauncherManagerHandlerNative(p_owner, - dialogUIProvider: new DialogUIProvider(p_owner, + dialogProvider: new DialogProvider(p_owner, Marshal.GetDelegateForFunctionPointer(new IntPtr(p_send_dialog)) ), fileSystemProvider: new FileSystemProvider(p_owner, @@ -51,20 +51,22 @@ public static unsafe partial class Bindings gameInfoProvider: new GameInfoProvider(p_owner, Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_install_path)) ), - launcherUProvider:new LauncherProvider(p_owner, + launcherStateUProvider: new LauncherStateProvider(p_owner, Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_game_parameters)), - Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_all_module_view_models)), - Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_module_view_models)), - Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_module_view_models)), Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_options)), Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_state)) ), - loadOrderProvider: new LoadOrderProvider(p_owner, + loadOrderPersistenceProvider: new LoadOrderPersistenceProvider(p_owner, Marshal.GetDelegateForFunctionPointer(new IntPtr(p_load_load_order)), Marshal.GetDelegateForFunctionPointer(new IntPtr(p_save_load_order)) ), - notificationUIProvider: new NotificationUIProvider(p_owner, + notificationProvider: new NotificationProvider(p_owner, Marshal.GetDelegateForFunctionPointer(new IntPtr(p_send_notification)) + ), + loadOrderStateProvider: new LoadOrderStateProvider(p_owner, + Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_all_module_view_models)), + Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_module_view_models)), + Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_module_view_models)) ) ); diff --git a/src/Bannerlord.LauncherManager.Native/LauncherManagerHandlerNative.cs b/src/Bannerlord.LauncherManager.Native/LauncherManagerHandlerNative.cs index 5262af1..54fbe04 100644 --- a/src/Bannerlord.LauncherManager.Native/LauncherManagerHandlerNative.cs +++ b/src/Bannerlord.LauncherManager.Native/LauncherManagerHandlerNative.cs @@ -1,4 +1,5 @@ using Bannerlord.LauncherManager.External; +using Bannerlord.LauncherManager.External.UI; using Bannerlord.LauncherManager.Localization; using Bannerlord.LauncherManager.Models; @@ -26,8 +27,15 @@ internal sealed unsafe class LauncherManagerHandlerNative : LauncherManagerHandl public param_ptr* OwnerPtr { get; } public VoidPtr* HandlePtr { get; } - public LauncherManagerHandlerNative(param_ptr* pOwner, ILauncherProvider launcherUProvider, IGameInfoProvider gameInfoProvider, ILoadOrderProvider loadOrderProvider, IFileSystemProvider fileSystemProvider, IDialogUIProvider dialogUIProvider, INotificationUIProvider notificationUIProvider) : - base(launcherUProvider, gameInfoProvider, loadOrderProvider, fileSystemProvider, dialogUIProvider, notificationUIProvider) + public LauncherManagerHandlerNative(param_ptr* pOwner, + ILauncherStateProvider launcherStateUProvider, + IGameInfoProvider gameInfoProvider, + ILoadOrderPersistenceProvider loadOrderPersistenceProvider, + IFileSystemProvider fileSystemProvider, + IDialogProvider dialogProvider, + INotificationProvider notificationProvider, + ILoadOrderStateProvider loadOrderStateProvider) : + base(launcherStateUProvider, gameInfoProvider, loadOrderPersistenceProvider, fileSystemProvider, dialogProvider, notificationProvider, loadOrderStateProvider) { OwnerPtr = pOwner; HandlePtr = (VoidPtr*) GCHandle.ToIntPtr(GCHandle.Alloc(this, GCHandleType.Normal)).ToPointer(); diff --git a/src/Bannerlord.LauncherManager/External/CallbackLauncherProvider.cs b/src/Bannerlord.LauncherManager/External/CallbackLauncherProvider.cs deleted file mode 100644 index 1a518d1..0000000 --- a/src/Bannerlord.LauncherManager/External/CallbackLauncherProvider.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Bannerlord.LauncherManager.Models; - -using System; -using System.Collections.Generic; - -namespace Bannerlord.LauncherManager.External; - -public sealed class CallbackLauncherProvider : ILauncherProvider -{ - private readonly Action> _setGameParameters; - private readonly Func _getAllModuleViewModels; - private readonly Func _getModuleViewModels; - private readonly Action> _setModuleViewModels; - private readonly Func _getOptions; - private readonly Func _getState; - - public CallbackLauncherProvider(Action> setGameParameters, Func getAllModuleViewModels, Func getModuleViewModels, Action> setModuleViewModels, Func getOptions, Func getState) - { - _setGameParameters = setGameParameters; - _getAllModuleViewModels = getAllModuleViewModels; - _getModuleViewModels = getModuleViewModels; - _setModuleViewModels = setModuleViewModels; - _getOptions = getOptions; - _getState = getState; - } - - public void SetGameParameters(string executable, IReadOnlyList gameParameters) => _setGameParameters(executable, gameParameters); - public IModuleViewModel[]? GetAllModuleViewModels() => _getAllModuleViewModels(); - public IModuleViewModel[]? GetModuleViewModels() => _getModuleViewModels(); - public void SetModuleViewModels(IReadOnlyList moduleViewModels) => _setModuleViewModels(moduleViewModels); - public LauncherOptions GetOptions() => _getOptions(); - public LauncherState GetState() => _getState(); -} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/External/CallbackLauncherStateProvider.cs b/src/Bannerlord.LauncherManager/External/CallbackLauncherStateProvider.cs new file mode 100644 index 0000000..dbb3b34 --- /dev/null +++ b/src/Bannerlord.LauncherManager/External/CallbackLauncherStateProvider.cs @@ -0,0 +1,25 @@ +using Bannerlord.LauncherManager.Models; + +using System; +using System.Collections.Generic; + +namespace Bannerlord.LauncherManager.External; + +public sealed class CallbackLauncherStateProvider : ILauncherStateProvider +{ + private readonly Action> _setGameParameters; + + private readonly Func _getOptions; + private readonly Func _getState; + + public CallbackLauncherStateProvider(Action> setGameParameters, Func getOptions, Func getState) + { + _setGameParameters = setGameParameters; + _getOptions = getOptions; + _getState = getState; + } + + public void SetGameParameters(string executable, IReadOnlyList gameParameters) => _setGameParameters(executable, gameParameters); + public LauncherOptions GetOptions() => _getOptions(); + public LauncherState GetState() => _getState(); +} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/External/CallbackLoadOrderProvider.cs b/src/Bannerlord.LauncherManager/External/CallbackLoadOrderPersistenceProvider.cs similarity index 61% rename from src/Bannerlord.LauncherManager/External/CallbackLoadOrderProvider.cs rename to src/Bannerlord.LauncherManager/External/CallbackLoadOrderPersistenceProvider.cs index c081c09..8c833a1 100644 --- a/src/Bannerlord.LauncherManager/External/CallbackLoadOrderProvider.cs +++ b/src/Bannerlord.LauncherManager/External/CallbackLoadOrderPersistenceProvider.cs @@ -2,14 +2,14 @@ using System; -namespace Bannerlord.LauncherManager.External; +namespace Bannerlord.LauncherManager.External.UI; -public sealed class CallbackLoadOrderProvider : ILoadOrderProvider +public sealed class CallbackLoadOrderPersistenceProvider : ILoadOrderPersistenceProvider { private readonly Func _loadLoadOrder; private readonly Action _saveLoadOrder; - public CallbackLoadOrderProvider(Func loadLoadOrder, Action saveLoadOrder) + public CallbackLoadOrderPersistenceProvider(Func loadLoadOrder, Action saveLoadOrder) { _loadLoadOrder = loadLoadOrder; _saveLoadOrder = saveLoadOrder; diff --git a/src/Bannerlord.LauncherManager/External/CallbackLoadOrderStateProvider.cs b/src/Bannerlord.LauncherManager/External/CallbackLoadOrderStateProvider.cs new file mode 100644 index 0000000..6b00125 --- /dev/null +++ b/src/Bannerlord.LauncherManager/External/CallbackLoadOrderStateProvider.cs @@ -0,0 +1,24 @@ +using Bannerlord.LauncherManager.Models; + +using System; +using System.Collections.Generic; + +namespace Bannerlord.LauncherManager.External; + +public sealed class CallbackLoadOrderStateProvider : ILoadOrderStateProvider +{ + private readonly Func _getAllModuleViewModels; + private readonly Func _getModuleViewModels; + private readonly Action> _setModuleViewModels; + + public CallbackLoadOrderStateProvider(Func getAllModuleViewModels, Func getModuleViewModels, Action> setModuleViewModels) + { + _getAllModuleViewModels = getAllModuleViewModels; + _getModuleViewModels = getModuleViewModels; + _setModuleViewModels = setModuleViewModels; + } + + public IModuleViewModel[]? GetAllModuleViewModels() => _getAllModuleViewModels(); + public IModuleViewModel[]? GetModuleViewModels() => _getModuleViewModels(); + public void SetModuleViewModels(IReadOnlyList moduleViewModels) => _setModuleViewModels(moduleViewModels); +} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/External/IDialogUIProvider.cs b/src/Bannerlord.LauncherManager/External/IDialogUIProvider.cs deleted file mode 100644 index fabca56..0000000 --- a/src/Bannerlord.LauncherManager/External/IDialogUIProvider.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Bannerlord.LauncherManager.Models; - -using System; -using System.Collections.Generic; - -namespace Bannerlord.LauncherManager.External; - -public interface IDialogUIProvider -{ - void SendDialog(DialogType type, string title, string message, IReadOnlyList filters, Action onResult); -} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/External/ILauncherProvider.cs b/src/Bannerlord.LauncherManager/External/ILauncherStateProvider.cs similarity index 56% rename from src/Bannerlord.LauncherManager/External/ILauncherProvider.cs rename to src/Bannerlord.LauncherManager/External/ILauncherStateProvider.cs index 09ec09d..e8b5e27 100644 --- a/src/Bannerlord.LauncherManager/External/ILauncherProvider.cs +++ b/src/Bannerlord.LauncherManager/External/ILauncherStateProvider.cs @@ -4,13 +4,9 @@ namespace Bannerlord.LauncherManager.External; -public interface ILauncherProvider +public interface ILauncherStateProvider { void SetGameParameters(string executable, IReadOnlyList gameParameters); - - IModuleViewModel[]? GetAllModuleViewModels(); - IModuleViewModel[]? GetModuleViewModels(); - void SetModuleViewModels(IReadOnlyList moduleViewModels); LauncherOptions GetOptions(); LauncherState GetState(); diff --git a/src/Bannerlord.LauncherManager/External/ILoadOrderPersistenceProvider.cs b/src/Bannerlord.LauncherManager/External/ILoadOrderPersistenceProvider.cs new file mode 100644 index 0000000..a868998 --- /dev/null +++ b/src/Bannerlord.LauncherManager/External/ILoadOrderPersistenceProvider.cs @@ -0,0 +1,18 @@ +using Bannerlord.LauncherManager.Models; + +namespace Bannerlord.LauncherManager.External; + +public interface ILoadOrderPersistenceProvider +{ + /// + /// Loads the LoadOrder from a persistent storage + /// + /// + LoadOrder LoadLoadOrder(); + + /// + /// Saves the LoadOrder to a persistent storage + /// + /// + void SaveLoadOrder(LoadOrder loadOrder); +} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/External/ILoadOrderProvider.cs b/src/Bannerlord.LauncherManager/External/ILoadOrderProvider.cs deleted file mode 100644 index e13c993..0000000 --- a/src/Bannerlord.LauncherManager/External/ILoadOrderProvider.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Bannerlord.LauncherManager.Models; - -namespace Bannerlord.LauncherManager.External; - -public interface ILoadOrderProvider -{ - LoadOrder LoadLoadOrder(); - void SaveLoadOrder(LoadOrder loadOrder); -} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/External/ILoadOrderStateProvider.cs b/src/Bannerlord.LauncherManager/External/ILoadOrderStateProvider.cs new file mode 100644 index 0000000..0e641ab --- /dev/null +++ b/src/Bannerlord.LauncherManager/External/ILoadOrderStateProvider.cs @@ -0,0 +1,26 @@ +using Bannerlord.LauncherManager.Models; + +using System.Collections.Generic; + +namespace Bannerlord.LauncherManager.External; + +public interface ILoadOrderStateProvider +{ + /// + /// Return all available ViewModels + /// + /// + IModuleViewModel[]? GetAllModuleViewModels(); + + /// + /// Returns the displayed ViewModels + /// + /// + IModuleViewModel[]? GetModuleViewModels(); + + /// + /// Sets the displayed ViewModels + /// + /// + void SetModuleViewModels(IReadOnlyList moduleViewModels); +} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/External/INotificationUIProvider.cs b/src/Bannerlord.LauncherManager/External/INotificationUIProvider.cs deleted file mode 100644 index 6299ddc..0000000 --- a/src/Bannerlord.LauncherManager/External/INotificationUIProvider.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Bannerlord.LauncherManager.Models; - -namespace Bannerlord.LauncherManager.External; - -public interface INotificationUIProvider -{ - void SendNotification(string id, NotificationType type, string message, uint displayMs); -} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/External/CallbackDialogUIProvider.cs b/src/Bannerlord.LauncherManager/External/UI/CallbackDialogProvider.cs similarity index 65% rename from src/Bannerlord.LauncherManager/External/CallbackDialogUIProvider.cs rename to src/Bannerlord.LauncherManager/External/UI/CallbackDialogProvider.cs index c716b07..9840a55 100644 --- a/src/Bannerlord.LauncherManager/External/CallbackDialogUIProvider.cs +++ b/src/Bannerlord.LauncherManager/External/UI/CallbackDialogProvider.cs @@ -3,13 +3,13 @@ using System; using System.Collections.Generic; -namespace Bannerlord.LauncherManager.External; +namespace Bannerlord.LauncherManager.External.UI; -public sealed class CallbackDialogUIProvider : IDialogUIProvider +public sealed class CallbackDialogProvider : IDialogProvider { private readonly Action, Action> _sendDialog; - public CallbackDialogUIProvider(Action, Action> sendDialog) + public CallbackDialogProvider(Action, Action> sendDialog) { _sendDialog = sendDialog; } diff --git a/src/Bannerlord.LauncherManager/External/CallbackNotificationUIProvider.cs b/src/Bannerlord.LauncherManager/External/UI/CallbackNotificationProvider.cs similarity index 60% rename from src/Bannerlord.LauncherManager/External/CallbackNotificationUIProvider.cs rename to src/Bannerlord.LauncherManager/External/UI/CallbackNotificationProvider.cs index 588bd8b..fff96f6 100644 --- a/src/Bannerlord.LauncherManager/External/CallbackNotificationUIProvider.cs +++ b/src/Bannerlord.LauncherManager/External/UI/CallbackNotificationProvider.cs @@ -2,13 +2,13 @@ using System; -namespace Bannerlord.LauncherManager.External; +namespace Bannerlord.LauncherManager.External.UI; -public sealed class CallbackNotificationUIProvider : INotificationUIProvider +public sealed class CallbackNotificationProvider : INotificationProvider { private readonly Action _sendNotification; - public CallbackNotificationUIProvider(Action sendNotification) + public CallbackNotificationProvider(Action sendNotification) { _sendNotification = sendNotification; } diff --git a/src/Bannerlord.LauncherManager/External/UI/IDialogProvider.cs b/src/Bannerlord.LauncherManager/External/UI/IDialogProvider.cs new file mode 100644 index 0000000..be8be2a --- /dev/null +++ b/src/Bannerlord.LauncherManager/External/UI/IDialogProvider.cs @@ -0,0 +1,19 @@ +using Bannerlord.LauncherManager.Models; + +using System; +using System.Collections.Generic; + +namespace Bannerlord.LauncherManager.External.UI; + +public interface IDialogProvider +{ + /// + /// Creates an interactable dialog + /// + /// + /// + /// + /// + /// + void SendDialog(DialogType type, string title, string message, IReadOnlyList filters, Action onResult); +} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/External/UI/INotificationProvider.cs b/src/Bannerlord.LauncherManager/External/UI/INotificationProvider.cs new file mode 100644 index 0000000..f1acf15 --- /dev/null +++ b/src/Bannerlord.LauncherManager/External/UI/INotificationProvider.cs @@ -0,0 +1,15 @@ +using Bannerlord.LauncherManager.Models; + +namespace Bannerlord.LauncherManager.External.UI; + +public interface INotificationProvider +{ + /// + /// Sends a UI notification + /// + /// + /// + /// + /// + void SendNotification(string id, NotificationType type, string message, uint displayMs); +} \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/External/IModuleViewModelProvider.cs b/src/Bannerlord.LauncherManager/IModuleViewModelProvider.cs similarity index 100% rename from src/Bannerlord.LauncherManager/External/IModuleViewModelProvider.cs rename to src/Bannerlord.LauncherManager/IModuleViewModelProvider.cs diff --git a/src/Bannerlord.LauncherManager/LauncherManagerHandler.Callbacks.cs b/src/Bannerlord.LauncherManager/LauncherManagerHandler.Callbacks.cs index 2fe72ec..8d02f44 100644 --- a/src/Bannerlord.LauncherManager/LauncherManagerHandler.Callbacks.cs +++ b/src/Bannerlord.LauncherManager/LauncherManagerHandler.Callbacks.cs @@ -12,7 +12,7 @@ partial class LauncherManagerHandler /// protected internal void RefreshGameParameters(string executable, IReadOnlyList gameParameters) { - LauncherProvider.SetGameParameters(executable, gameParameters); + LauncherStateProvider.SetGameParameters(executable, gameParameters); } /// @@ -20,7 +20,7 @@ protected internal void RefreshGameParameters(string executable, IReadOnlyList protected internal LoadOrder LoadLoadOrder() { - return LoadOrderProvider.LoadLoadOrder(); + return LoadOrderPersistenceProvider.LoadLoadOrder(); } /// @@ -28,7 +28,7 @@ protected internal LoadOrder LoadLoadOrder() /// protected internal void SaveLoadOrder(LoadOrder loadOrder) { - LoadOrderProvider.SaveLoadOrder(loadOrder); + LoadOrderPersistenceProvider.SaveLoadOrder(loadOrder); SetGameParameterLoadOrder(loadOrder); } @@ -38,7 +38,7 @@ protected internal void SaveLoadOrder(LoadOrder loadOrder) /// protected internal void SendNotification(string id, NotificationType type, string message, uint displayMs) { - NotificationUIProvider.SendNotification(id, type, message, displayMs); + NotificationProvider.SendNotification(id, type, message, displayMs); } /// @@ -46,7 +46,7 @@ protected internal void SendNotification(string id, NotificationType type, strin /// protected internal void SendDialog(DialogType type, string title, string message, IReadOnlyList filters, Action onResult) { - DialogUIProvider.SendDialog(type, title, message, filters, onResult); + DialogProvider.SendDialog(type, title, message, filters, onResult); } /// @@ -95,7 +95,7 @@ protected internal void WriteFileContent(string filePath, byte[]? data) /// protected internal IModuleViewModel[]? GetAllModuleViewModels() { - return LauncherProvider.GetAllModuleViewModels(); + return LoadOrderStateProvider.GetAllModuleViewModels(); } /// @@ -104,7 +104,7 @@ protected internal void WriteFileContent(string filePath, byte[]? data) /// protected internal IModuleViewModel[]? GetModuleViewModels() { - return LauncherProvider.GetModuleViewModels(); + return LoadOrderStateProvider.GetModuleViewModels(); } /// @@ -113,7 +113,7 @@ protected internal void WriteFileContent(string filePath, byte[]? data) /// protected internal void SetModuleViewModels(IReadOnlyList orderedModules) { - LauncherProvider.SetModuleViewModels(orderedModules); + LoadOrderStateProvider.SetModuleViewModels(orderedModules); } /// @@ -121,7 +121,7 @@ protected internal void SetModuleViewModels(IReadOnlyList orde /// protected internal LauncherOptions GetOptions() { - return LauncherProvider.GetOptions(); + return LauncherStateProvider.GetOptions(); } /// @@ -129,6 +129,6 @@ protected internal LauncherOptions GetOptions() /// protected internal LauncherState GetState() { - return LauncherProvider.GetState(); + return LauncherStateProvider.GetState(); } } \ No newline at end of file diff --git a/src/Bannerlord.LauncherManager/LauncherManagerHandler.cs b/src/Bannerlord.LauncherManager/LauncherManagerHandler.cs index 87e7766..5ace432 100644 --- a/src/Bannerlord.LauncherManager/LauncherManagerHandler.cs +++ b/src/Bannerlord.LauncherManager/LauncherManagerHandler.cs @@ -2,6 +2,7 @@ using Bannerlord.LauncherManager.Extensions; #endif using Bannerlord.LauncherManager.External; +using Bannerlord.LauncherManager.External.UI; using Bannerlord.LauncherManager.Models; using Bannerlord.LauncherManager.Utils; using Bannerlord.ModuleManager; @@ -13,27 +14,30 @@ namespace Bannerlord.LauncherManager; public partial class LauncherManagerHandler { - protected ILauncherProvider LauncherProvider { get; } + protected ILauncherStateProvider LauncherStateProvider { get; } protected IGameInfoProvider GameInfoProvider { get; } - protected ILoadOrderProvider LoadOrderProvider { get; } + protected ILoadOrderPersistenceProvider LoadOrderPersistenceProvider { get; } protected IFileSystemProvider FileSystemProvider { get; } - protected IDialogUIProvider DialogUIProvider { get; } - protected INotificationUIProvider NotificationUIProvider { get; } + protected IDialogProvider DialogProvider { get; } + protected INotificationProvider NotificationProvider { get; } + protected ILoadOrderStateProvider LoadOrderStateProvider { get; } public LauncherManagerHandler( - ILauncherProvider launcherProvider, + ILauncherStateProvider launcherStateProvider, IGameInfoProvider gameInfoProvider, - ILoadOrderProvider loadOrderProvider, + ILoadOrderPersistenceProvider loadOrderPersistenceProvider, IFileSystemProvider fileSystemProvider, - IDialogUIProvider dialogUIProvider, - INotificationUIProvider notificationUIProvider) + IDialogProvider dialogProvider, + INotificationProvider notificationProvider, + ILoadOrderStateProvider loadOrderStateProvider) { - LauncherProvider = launcherProvider; + LauncherStateProvider = launcherStateProvider; GameInfoProvider = gameInfoProvider; - LoadOrderProvider = loadOrderProvider; + LoadOrderPersistenceProvider = loadOrderPersistenceProvider; FileSystemProvider = fileSystemProvider; - DialogUIProvider = dialogUIProvider; - NotificationUIProvider = notificationUIProvider; + DialogProvider = dialogProvider; + NotificationProvider = notificationProvider; + LoadOrderStateProvider = loadOrderStateProvider; _providers = new IModulePathProvider[] { new MainModuleProvider(this), diff --git a/test/Bannerlord.LauncherManager.Tests/HandlerTests.cs b/test/Bannerlord.LauncherManager.Tests/HandlerTests.cs index 12e3a20..9c87eb2 100644 --- a/test/Bannerlord.LauncherManager.Tests/HandlerTests.cs +++ b/test/Bannerlord.LauncherManager.Tests/HandlerTests.cs @@ -1,4 +1,5 @@ using Bannerlord.LauncherManager.External; +using Bannerlord.LauncherManager.External.UI; using Bannerlord.LauncherManager.Models; using Bannerlord.ModuleManager; @@ -14,13 +15,14 @@ namespace Bannerlord.LauncherManager.Tests; public class LauncherManagerHandlerExposer : LauncherManagerHandler { public LauncherManagerHandlerExposer( - ILauncherProvider launcherUProvider, + ILauncherStateProvider launcherStateUProvider, IGameInfoProvider gameInfoProvider, - ILoadOrderProvider loadOrderProvider, - IFileSystemProvider fileSystemProviderProvider, - IDialogUIProvider dialogUIProviderProvider, - INotificationUIProvider notificationUIProviderProvider) : - base(launcherUProvider, gameInfoProvider, loadOrderProvider, fileSystemProviderProvider, dialogUIProviderProvider, notificationUIProviderProvider) { } + ILoadOrderPersistenceProvider loadOrderPersistenceProvider, + IFileSystemProvider fileSystemProvider, + IDialogProvider dialogProviderProvider, + INotificationProvider notificationProviderProvider, + ILoadOrderStateProvider loadOrderStateProvider) : + base(launcherStateUProvider, gameInfoProvider, loadOrderPersistenceProvider, fileSystemProvider, dialogProviderProvider, notificationProviderProvider, loadOrderStateProvider) { } public new IReadOnlyList GetModules() => base.GetModules(); } @@ -75,10 +77,10 @@ public void Sorter_Sort_Test() var moduleViewModels = Array.Empty(); var handler = new LauncherManagerHandlerExposer( - dialogUIProviderProvider: new CallbackDialogUIProvider( + dialogProviderProvider: new CallbackDialogProvider( sendDialog: null! ), - fileSystemProviderProvider: new CallbackFileSystemProvider( + fileSystemProvider: new CallbackFileSystemProvider( readFileContent: Read, writeFileContent: null!, readDirectoryFileList: directory => Directory.Exists(directory) ? Directory.GetFiles(directory) : null, @@ -87,21 +89,22 @@ public void Sorter_Sort_Test() gameInfoProvider: new CallbackGameInfoProvider( getInstallPath: () => Path.GetFullPath(GamePath)! ), - notificationUIProviderProvider: new CallbackNotificationUIProvider( + notificationProviderProvider: new CallbackNotificationProvider( sendNotification: (id, type, message, ms) => { } ), - launcherUProvider: new CallbackLauncherProvider( + launcherStateUProvider: new CallbackLauncherStateProvider( setGameParameters: (executable, parameters) => { }, - getAllModuleViewModels: () => moduleViewModels, - getModuleViewModels: () => moduleViewModels, - setModuleViewModels: null!, getOptions: null!, getState: null! ), - loadOrderProvider: new CallbackLoadOrderProvider( + loadOrderPersistenceProvider: new CallbackLoadOrderPersistenceProvider( loadLoadOrder: null!, saveLoadOrder: lo => loadOrder = lo - ) + ), + loadOrderStateProvider: new CallbackLoadOrderStateProvider( + getAllModuleViewModels: () => moduleViewModels, + getModuleViewModels: () => moduleViewModels, + setModuleViewModels: null!) ); var modules = handler.GetModules(); @@ -134,10 +137,10 @@ public void Sorter_Sort_Test() public void ModuleProvider_GetModules_Test() { var handler = new LauncherManagerHandlerExposer( - dialogUIProviderProvider: new CallbackDialogUIProvider( + dialogProviderProvider: new CallbackDialogProvider( sendDialog: null! ), - fileSystemProviderProvider: new CallbackFileSystemProvider( + fileSystemProvider: new CallbackFileSystemProvider( readFileContent: Read, writeFileContent: null!, readDirectoryFileList: null!, @@ -146,21 +149,22 @@ public void ModuleProvider_GetModules_Test() gameInfoProvider: new CallbackGameInfoProvider( getInstallPath: () => Path.GetFullPath(GamePath)! ), - notificationUIProviderProvider: new CallbackNotificationUIProvider( + notificationProviderProvider: new CallbackNotificationProvider( sendNotification: null! ), - launcherUProvider: new CallbackLauncherProvider( + launcherStateUProvider: new CallbackLauncherStateProvider( setGameParameters: null!, - getAllModuleViewModels: null!, - getModuleViewModels: null!, - setModuleViewModels: null!, getOptions: null!, getState: null! ), - loadOrderProvider: new CallbackLoadOrderProvider( + loadOrderPersistenceProvider: new CallbackLoadOrderPersistenceProvider( loadLoadOrder: null!, saveLoadOrder: null! - ) + ), + loadOrderStateProvider: new CallbackLoadOrderStateProvider( + getAllModuleViewModels: null!, + getModuleViewModels: null!, + setModuleViewModels: null!) ); var modules = handler.GetModules().ToList(); @@ -180,10 +184,10 @@ public void Handler_TestModule_tTest() }; var handler = new LauncherManagerHandlerExposer( - dialogUIProviderProvider: new CallbackDialogUIProvider( + dialogProviderProvider: new CallbackDialogProvider( sendDialog: null! ), - fileSystemProviderProvider: new CallbackFileSystemProvider( + fileSystemProvider: new CallbackFileSystemProvider( readFileContent: null!, writeFileContent: null!, readDirectoryFileList: null!, @@ -192,21 +196,22 @@ public void Handler_TestModule_tTest() gameInfoProvider: new CallbackGameInfoProvider( getInstallPath: null! ), - notificationUIProviderProvider: new CallbackNotificationUIProvider( + notificationProviderProvider: new CallbackNotificationProvider( sendNotification: null! ), - launcherUProvider: new CallbackLauncherProvider( + launcherStateUProvider: new CallbackLauncherStateProvider( setGameParameters: null!, - getAllModuleViewModels: null!, - getModuleViewModels: null!, - setModuleViewModels: null!, getOptions: null!, getState: null! ), - loadOrderProvider: new CallbackLoadOrderProvider( + loadOrderPersistenceProvider: new CallbackLoadOrderPersistenceProvider( loadLoadOrder: null!, saveLoadOrder: null! - ) + ), + loadOrderStateProvider: new CallbackLoadOrderStateProvider( + getAllModuleViewModels: null!, + getModuleViewModels: null!, + setModuleViewModels: null!) ); var installResult = handler.TestModuleContent(files); @@ -235,10 +240,10 @@ public void Handler_InstallModule_Test() }; var handler = new LauncherManagerHandlerExposer( - dialogUIProviderProvider: new CallbackDialogUIProvider( + dialogProviderProvider: new CallbackDialogProvider( sendDialog: null! ), - fileSystemProviderProvider: new CallbackFileSystemProvider( + fileSystemProvider: new CallbackFileSystemProvider( readFileContent: Read, writeFileContent: null!, readDirectoryFileList: null!, @@ -247,21 +252,22 @@ public void Handler_InstallModule_Test() gameInfoProvider: new CallbackGameInfoProvider( getInstallPath: () => Path.GetFullPath(GamePath)! ), - notificationUIProviderProvider: new CallbackNotificationUIProvider( + notificationProviderProvider: new CallbackNotificationProvider( sendNotification: null! ), - launcherUProvider: new CallbackLauncherProvider( + launcherStateUProvider: new CallbackLauncherStateProvider( setGameParameters: null!, - getAllModuleViewModels: null!, - getModuleViewModels: null!, - setModuleViewModels: null!, getOptions: null!, getState: null! ), - loadOrderProvider: new CallbackLoadOrderProvider( + loadOrderPersistenceProvider: new CallbackLoadOrderPersistenceProvider( loadLoadOrder: null!, saveLoadOrder: null! - ) + ), + loadOrderStateProvider: new CallbackLoadOrderStateProvider( + getAllModuleViewModels: null!, + getModuleViewModels: null!, + setModuleViewModels: null!) ); handler.SetGameStore(GameStore.Steam);