From 033db785366e3e544aacefc257cec2d05fdca8d7 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Wed, 10 Apr 2024 00:07:52 +0300 Subject: [PATCH] Fixed a possible casting issue, switched to collection expression --- .../Adapters/DialogProvider.cs | 2 +- .../Bindings.FetchBannerlordVersion.cs | 6 +- .../Bindings.LauncherManager.cs | 79 ++++++++++--------- .../Bindings.ModuleManager.cs | 36 ++++----- .../Bindings.Shared.cs | 6 +- .../Bindings.Utils.cs | 4 +- .../Models/ModuleViewModel.cs | 1 - 7 files changed, 69 insertions(+), 65 deletions(-) diff --git a/src/Bannerlord.LauncherManager.Native/Adapters/DialogProvider.cs b/src/Bannerlord.LauncherManager.Native/Adapters/DialogProvider.cs index 02ff92a..6307793 100644 --- a/src/Bannerlord.LauncherManager.Native/Adapters/DialogProvider.cs +++ b/src/Bannerlord.LauncherManager.Native/Adapters/DialogProvider.cs @@ -28,7 +28,7 @@ public void SendDialog(DialogType type, string title, string message, IReadOnlyL private void SendDialogNative(ReadOnlySpan type, ReadOnlySpan title, ReadOnlySpan message, IReadOnlyList filters, Action onResult) { - [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(CallConvs = [typeof(CallConvCdecl)])] static void Callback(param_ptr* p_ptr, param_string* p_result) { Logger.LogInput($"{nameof(SendDialogNative)}_{nameof(Callback)}"); diff --git a/src/Bannerlord.LauncherManager.Native/Bindings.FetchBannerlordVersion.cs b/src/Bannerlord.LauncherManager.Native/Bindings.FetchBannerlordVersion.cs index 4121ea3..cfff6e7 100644 --- a/src/Bannerlord.LauncherManager.Native/Bindings.FetchBannerlordVersion.cs +++ b/src/Bannerlord.LauncherManager.Native/Bindings.FetchBannerlordVersion.cs @@ -11,7 +11,7 @@ namespace Bannerlord.LauncherManager.Native; public static unsafe partial class Bindings { - [UnmanagedCallersOnly(EntryPoint = "bfv_get_change_set", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bfv_get_change_set", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_uint32* GetChangeSet([IsConst] param_string* p_game_folder_path, [IsConst] param_string* p_lib_assembly) { Logger.LogInput(p_game_folder_path, p_lib_assembly); @@ -32,7 +32,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bfv_get_version", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bfv_get_version", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_string* GetVersion([IsConst] param_string* p_game_folder_path, [IsConst] param_string* p_lib_assembly) { Logger.LogInput(p_game_folder_path, p_lib_assembly); @@ -53,7 +53,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bfv_get_version_type", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bfv_get_version_type", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_uint32* GetVersionType([IsConst] param_string* p_game_folder_path, [IsConst] param_string* p_lib_assembly) { Logger.LogInput(p_game_folder_path, p_lib_assembly); diff --git a/src/Bannerlord.LauncherManager.Native/Bindings.LauncherManager.cs b/src/Bannerlord.LauncherManager.Native/Bindings.LauncherManager.cs index 292ad55..86ff4cc 100644 --- a/src/Bannerlord.LauncherManager.Native/Bindings.LauncherManager.cs +++ b/src/Bannerlord.LauncherManager.Native/Bindings.LauncherManager.cs @@ -17,7 +17,7 @@ namespace Bannerlord.LauncherManager.Native; public static unsafe partial class Bindings { - [UnmanagedCallersOnly(EntryPoint = "ve_create_handler", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_create_handler", CallConvs = [typeof(CallConvCdecl)])] public static return_value_ptr* CreateHandler(param_ptr* p_owner, delegate* unmanaged[Cdecl] p_set_game_parameters, delegate* unmanaged[Cdecl] p_load_load_order, @@ -80,7 +80,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_dispose_handler", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_dispose_handler", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* DisposeHandler(param_ptr* p_handle) { Logger.LogInput(); @@ -102,13 +102,13 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "ve_load_localization", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_load_localization", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* LoadLocalization(param_ptr* p_handle, param_string* p_xml) { Logger.LogInput(); try { - if (p_handle is null || LauncherManagerHandlerNative.FromPointer(p_handle) is not { }) + if (p_handle is null || LauncherManagerHandlerNative.FromPointer(p_handle) is not { } handler) return return_value_void.AsError(BUTR.NativeAOT.Shared.Utils.Copy("Handler is null or wrong!", false), false); var doc = new XmlDocument(); @@ -126,7 +126,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "ve_get_game_version", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_get_game_version", CallConvs = [typeof(CallConvCdecl)])] public static return_value_string* GetGameVersion(param_ptr* p_handle) { Logger.LogInput(); @@ -148,7 +148,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "ve_test_module", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_test_module", CallConvs = [typeof(CallConvCdecl)])] public static return_value_json* TestModule(param_ptr* p_handle, param_json* p_files) { Logger.LogInput(p_files); @@ -170,7 +170,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_install_module", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_install_module", CallConvs = [typeof(CallConvCdecl)])] public static return_value_json* InstallModule(param_ptr* p_handle, param_json* p_files, param_json* p_module_infos) { Logger.LogInput(p_files, p_module_infos); @@ -194,7 +194,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "ve_is_sorting", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_is_sorting", CallConvs = [typeof(CallConvCdecl)])] public static return_value_bool* IsSorting(param_ptr* p_handle) { Logger.LogInput(); @@ -215,7 +215,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_sort", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_sort", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* Sort(param_ptr* p_handle) { Logger.LogInput(); @@ -237,7 +237,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "ve_load_load_order", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_load_load_order", CallConvs = [typeof(CallConvCdecl)])] public static return_value_json* LoadLoadOrder(param_ptr* p_handle) { Logger.LogInput(); @@ -258,7 +258,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_save_load_order", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_save_load_order", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* SaveLoadOrder(param_ptr* p_handle, param_json* p_load_order) { Logger.LogInput(p_load_order); @@ -280,7 +280,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_refresh_modules", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_refresh_modules", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* RefreshModules(param_ptr* p_handle) { Logger.LogInput(); @@ -302,7 +302,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "ve_refresh_game_parameters", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_refresh_game_parameters", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* RefreshGameParameters(param_ptr* p_handle) { Logger.LogInput(); @@ -324,7 +324,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "ve_get_modules", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_get_modules", CallConvs = [typeof(CallConvCdecl)])] public static return_value_json* GetModules(param_ptr* p_handle) { Logger.LogInput(); @@ -346,7 +346,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "ve_check_for_root_harmony", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_check_for_root_harmony", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* CheckForRootHarmony(param_ptr* p_handle) { Logger.LogInput(); @@ -368,7 +368,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "ve_module_list_handler_export", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_module_list_handler_export", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* ModuleListHandlerExport(param_ptr* p_handle) { Logger.LogInput(); @@ -390,7 +390,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_module_list_handler_export_save_file", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_module_list_handler_export_save_file", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* ModuleListHandlerExportSaveFile(param_ptr* p_handle, param_string* p_save_file) { Logger.LogInput(p_save_file); @@ -414,7 +414,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_module_list_handler_import", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_module_list_handler_import", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* ModuleListHandlerImport(param_ptr* p_handle, param_ptr* p_callback_handler, delegate* unmanaged[Cdecl] p_callback) { Logger.LogInput(); @@ -441,7 +441,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_module_list_handler_import_save_file", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_module_list_handler_import_save_file", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* ModuleListHandlerImportSaveFile(param_ptr* p_handle, param_string* p_save_file, param_ptr* p_callback_handler, delegate* unmanaged[Cdecl] p_callback) { Logger.LogInput(p_save_file); @@ -471,7 +471,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "ve_sort_helper_validate_module", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_sort_helper_validate_module", CallConvs = [typeof(CallConvCdecl)])] public static return_value_json* SortHelperValidateModule(param_ptr* p_handle, param_json* p_module_view_model) { Logger.LogInput(p_module_view_model); @@ -496,7 +496,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_sort_helper_toggle_module_selection", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_sort_helper_toggle_module_selection", CallConvs = [typeof(CallConvCdecl)])] public static return_value_json* SortHelperToggleModuleSelection(param_ptr* p_handle, param_json* p_module_view_model) { Logger.LogInput(p_module_view_model); @@ -521,7 +521,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_sort_helper_change_module_position", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_sort_helper_change_module_position", CallConvs = [typeof(CallConvCdecl)])] public static return_value_bool* SortHelperChangeModulePosition(param_ptr* p_handle, param_json* p_module_view_model, param_int insertIndex) { Logger.LogInput(p_module_view_model, &insertIndex); @@ -549,8 +549,8 @@ public static unsafe partial class Bindings } } - - [UnmanagedCallersOnly(EntryPoint = "ve_get_save_files", CallConvs = new[] { typeof(CallConvCdecl) })] + + [UnmanagedCallersOnly(EntryPoint = "ve_get_save_files", CallConvs = [typeof(CallConvCdecl)])] public static return_value_json* GetSaveFiles(param_ptr* p_handle) { Logger.LogInput(); @@ -571,7 +571,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_get_save_metadata", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_get_save_metadata", CallConvs = [typeof(CallConvCdecl)])] public static return_value_json* GetSaveMetadata(param_ptr* p_handle, param_string* p_save_file, param_data* p_data, param_int data_len) { Logger.LogInput(p_save_file, p_data, &data_len); @@ -596,7 +596,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "ve_get_save_file_path", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_get_save_file_path", CallConvs = [typeof(CallConvCdecl)])] public static return_value_string* GetSaveFilePath(param_ptr* p_handle, param_string* p_save_file) { Logger.LogInput(p_save_file); @@ -622,7 +622,7 @@ public static unsafe partial class Bindings public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, IReadOnlyList? OrderedModuleViewModels); - [UnmanagedCallersOnly(EntryPoint = "ve_order_by_load_order", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_order_by_load_order", CallConvs = [typeof(CallConvCdecl)])] public static return_value_json* OrderByLoadOrder(param_ptr* p_handle, param_json* p_load_order) { Logger.LogInput(p_load_order); @@ -635,7 +635,12 @@ public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, var loadOrderDict = loadOrder.ToDictionary(x => x.Key, x => x.Value.IsSelected); var res = handler.TryOrderByLoadOrder(loadOrder.OrderBy(x => x.Value.Index).Select(x => x.Key), x => loadOrderDict.TryGetValue(x, out var isSelected) && isSelected, out var issues, out var orderedModuleViewModels); - var result = new OrderByLoadOrderResult(res, issues, orderedModuleViewModels.Cast().ToArray()); + var result = new OrderByLoadOrderResult(res, issues, orderedModuleViewModels.Select(x => new ModuleViewModel(x.ModuleInfoExtended, x.IsValid) + { + IsSelected = x.IsSelected, + IsDisabled = x.IsDisabled, + Index = x.Index, + }).ToArray()); Logger.LogOutput(result); return return_value_json.AsValue(result, CustomSourceGenerationContext.OrderByLoadOrderResult, false); @@ -648,7 +653,7 @@ public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, } - [UnmanagedCallersOnly(EntryPoint = "ve_set_game_parameter_executable", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_set_game_parameter_executable", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* SetGameParameterExecutable(param_ptr* p_handle, param_string* p_executable) { Logger.LogInput(p_executable); @@ -671,7 +676,7 @@ public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, } } - [UnmanagedCallersOnly(EntryPoint = "ve_set_game_parameter_load_order", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_set_game_parameter_load_order", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* SetGameParameterLoadOrder(param_ptr* p_handle, param_json* p_load_order) { Logger.LogInput(p_load_order); @@ -694,7 +699,7 @@ public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, } } - [UnmanagedCallersOnly(EntryPoint = "ve_set_game_parameter_save_file", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_set_game_parameter_save_file", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* SetGameParameterSaveFile(param_ptr* p_handle, param_string* p_save_file) { Logger.LogInput(p_save_file); @@ -717,7 +722,7 @@ public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, } } - [UnmanagedCallersOnly(EntryPoint = "ve_set_game_parameter_continue_last_save_file", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_set_game_parameter_continue_last_save_file", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* SetGameParameterContinueLastSaveFile(param_ptr* p_handle, param_bool p_value) { Logger.LogInput(p_value); @@ -739,7 +744,7 @@ public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, } - [UnmanagedCallersOnly(EntryPoint = "ve_set_game_store", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_set_game_store", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* SetGameStore(param_ptr* p_handle, param_string* p_game_store) { Logger.LogInput(p_game_store); @@ -763,7 +768,7 @@ public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, } } - [UnmanagedCallersOnly(EntryPoint = "ve_get_game_platform", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_get_game_platform", CallConvs = [typeof(CallConvCdecl)])] public static return_value_string* GetGamePlatform(param_ptr* p_handle) { Logger.LogInput(); @@ -783,7 +788,7 @@ public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, } - [UnmanagedCallersOnly(EntryPoint = "ve_localize_string", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_localize_string", CallConvs = [typeof(CallConvCdecl)])] public static return_value_string* LocalizeString(param_ptr* p_handle, param_string* p_template, param_json* p_values) { Logger.LogInput(p_template, p_values); @@ -808,7 +813,7 @@ public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, } - [UnmanagedCallersOnly(EntryPoint = "ve_dialog_test_warning", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_dialog_test_warning", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* DialogTestWarning(param_ptr* p_handle, param_ptr* p_callback_handler, delegate* unmanaged[Cdecl] p_callback) { Logger.LogInput(); @@ -837,7 +842,7 @@ public record OrderByLoadOrderResult(bool Result, IReadOnlyList? Issues, } } - [UnmanagedCallersOnly(EntryPoint = "ve_dialog_test_file_open", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "ve_dialog_test_file_open", CallConvs = [typeof(CallConvCdecl)])] public static return_value_void* DialogTestFileOpen(param_ptr* p_handle, param_ptr* p_callback_handler, delegate* unmanaged[Cdecl] p_callback) { Logger.LogInput(); diff --git a/src/Bannerlord.LauncherManager.Native/Bindings.ModuleManager.cs b/src/Bannerlord.LauncherManager.Native/Bindings.ModuleManager.cs index 3e531d5..70283dc 100644 --- a/src/Bannerlord.LauncherManager.Native/Bindings.ModuleManager.cs +++ b/src/Bannerlord.LauncherManager.Native/Bindings.ModuleManager.cs @@ -26,7 +26,7 @@ public static unsafe partial class Bindings private static readonly ApplicationVersionComparer _applicationVersionComparer = new(); - [UnmanagedCallersOnly(EntryPoint = "bmm_sort", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_sort", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* Sort([IsConst] param_json* p_source) { Logger.LogInput(p_source); @@ -46,7 +46,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bmm_sort_with_options", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_sort_with_options", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* SortWithOptions([IsConst] param_json* p_source, [IsConst] param_json* p_options) { Logger.LogInput(p_source, p_options); @@ -68,7 +68,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "bmm_are_all_dependencies_of_module_present", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_are_all_dependencies_of_module_present", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_bool* AreAllDependenciesOfModulePresent([IsConst] param_json* p_source, [IsConst] param_json* p_module) { Logger.LogInput(p_source, p_module); @@ -90,7 +90,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependent_modules_of", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependent_modules_of", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* GetDependentModulesOf([IsConst] param_json* p_source, [IsConst] param_json* p_module) { Logger.LogInput(p_source, p_module); @@ -111,7 +111,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependent_modules_of_with_options", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependent_modules_of_with_options", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* GetDependentModulesOfWithOptions([IsConst] param_json* p_source, [IsConst] param_json* p_module, [IsConst] param_json* p_options) { Logger.LogInput(p_source, p_module, p_options); @@ -134,7 +134,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "bmm_validate_module", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_validate_module", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* ValidateModule([IsConst] param_ptr* p_owner, [IsConst] param_json* p_modules, [IsConst] param_json* p_target_module, [ConstMeta, IsConst, IsNotConst>] delegate* unmanaged[Cdecl] p_is_selected) @@ -171,7 +171,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bmm_validate_load_order", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_validate_load_order", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* ValidateLoadOrder([IsConst] param_json* p_modules, [IsConst] param_json* p_target_module) { Logger.LogInput(p_modules, p_target_module); @@ -193,7 +193,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "bmm_enable_module", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_enable_module", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_void* EnableModule([IsConst] param_ptr* p_owner, [IsConst] param_json* p_module, [IsConst] param_json* p_target_module, [ConstMeta, IsConst, IsNotConst>] delegate* unmanaged[Cdecl] p_get_selected, @@ -273,7 +273,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bmm_disable_module", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_disable_module", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_void* DisableModule([IsConst] param_ptr* p_owner, [IsConst] param_json* p_module, [IsConst] param_json* p_target_module, [ConstMeta, IsConst, IsNotConst>] delegate* unmanaged[Cdecl] p_get_selected, @@ -354,7 +354,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_module_info", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_get_module_info", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* GetModuleInfo([IsConst] param_string* p_xml_content) { Logger.LogInput(p_xml_content); @@ -375,7 +375,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_module_info_with_path", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_get_module_info_with_path", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* GetModuleInfoWithPath([IsConst] param_string* p_xml_content, [IsConst] param_string* p_path) { Logger.LogInput(p_xml_content, p_path); @@ -397,7 +397,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_sub_module_info", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_get_sub_module_info", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* GetSubModuleInfo([IsConst] param_string* p_xml_content) { Logger.LogInput(p_xml_content); @@ -423,7 +423,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bmm_parse_application_version", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_parse_application_version", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* ParseApplicationVersion([IsConst] param_string* p_application_version) { Logger.LogInput(p_application_version); @@ -440,7 +440,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "bmm_compare_versions", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_compare_versions", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_int32* CompareVersions([IsConst] param_json* p_x, [IsConst] param_json* p_y) { Logger.LogInput(p_x, p_y); @@ -462,7 +462,7 @@ public static unsafe partial class Bindings } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_all", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_all", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* GetDependenciesAll([IsConst] param_json* p_module) { Logger.LogInput(p_module); @@ -481,7 +481,7 @@ public static unsafe partial class Bindings return return_value_json.AsException(e, false); } } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_load_before_this", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_load_before_this", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* GetDependenciesLoadBeforeThis([IsConst] param_json* p_module) { Logger.LogInput(p_module); @@ -500,7 +500,7 @@ public static unsafe partial class Bindings return return_value_json.AsException(e, false); } } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_load_after_this", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_load_after_this", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* GetDependenciesLoadAfterThis([IsConst] param_json* p_module) { Logger.LogInput(p_module); @@ -519,7 +519,7 @@ public static unsafe partial class Bindings return return_value_json.AsException(e, false); } } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_incompatibles", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_incompatibles", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* GetDependenciesIncompatibles([IsConst] param_json* p_module) { Logger.LogInput(p_module); diff --git a/src/Bannerlord.LauncherManager.Native/Bindings.Shared.cs b/src/Bannerlord.LauncherManager.Native/Bindings.Shared.cs index 21307a6..24b08d4 100644 --- a/src/Bannerlord.LauncherManager.Native/Bindings.Shared.cs +++ b/src/Bannerlord.LauncherManager.Native/Bindings.Shared.cs @@ -8,7 +8,7 @@ namespace Bannerlord.LauncherManager.Native; public static unsafe partial class Bindings { - [UnmanagedCallersOnly(EntryPoint = "common_alloc", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "common_alloc", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static void* CommonAlloc(nuint size) { Logger.LogInput(size); @@ -26,7 +26,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "common_dealloc", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "common_dealloc", CallConvs = [typeof(CallConvCdecl)])] public static void Common_Dealloc([IsConst] param_ptr* ptr) { Logger.LogInput(ptr); @@ -42,7 +42,7 @@ public static void Common_Dealloc([IsConst] param_ptr* ptr) } } - [UnmanagedCallersOnly(EntryPoint = "common_alloc_alive_count", CallConvs = new[] { typeof(CallConvCdecl) })] + [UnmanagedCallersOnly(EntryPoint = "common_alloc_alive_count", CallConvs = [typeof(CallConvCdecl)])] public static int CommonAllocAliveCount() { Logger.LogInput(); diff --git a/src/Bannerlord.LauncherManager.Native/Bindings.Utils.cs b/src/Bannerlord.LauncherManager.Native/Bindings.Utils.cs index 9f496ce..45e7447 100644 --- a/src/Bannerlord.LauncherManager.Native/Bindings.Utils.cs +++ b/src/Bannerlord.LauncherManager.Native/Bindings.Utils.cs @@ -11,7 +11,7 @@ namespace Bannerlord.LauncherManager.Native; public static unsafe partial class Bindings { - [UnmanagedCallersOnly(EntryPoint = "utils_is_load_order_correct", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "utils_is_load_order_correct", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_json* IsLoadOrderCorrect([IsConst] param_json* p_modules) { Logger.LogInput(p_modules); @@ -31,7 +31,7 @@ public static unsafe partial class Bindings } } - [UnmanagedCallersOnly(EntryPoint = "utils_get_dependency_hint", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + [UnmanagedCallersOnly(EntryPoint = "utils_get_dependency_hint", CallConvs = [typeof(CallConvCdecl)]), IsNotConst] public static return_value_string* GetDependencyHint([IsConst] param_json* p_module) { Logger.LogInput(p_module); diff --git a/src/Bannerlord.LauncherManager.Native/Models/ModuleViewModel.cs b/src/Bannerlord.LauncherManager.Native/Models/ModuleViewModel.cs index 7113949..5201784 100644 --- a/src/Bannerlord.LauncherManager.Native/Models/ModuleViewModel.cs +++ b/src/Bannerlord.LauncherManager.Native/Models/ModuleViewModel.cs @@ -21,5 +21,4 @@ public ModuleViewModel(ModuleInfoExtendedWithPath moduleInfoExtended, bool isVal ModuleInfoExtended = moduleInfoExtended; IsValid = isValid; } - } \ No newline at end of file