diff --git a/.github/workflows/publish-native-ts.yml b/.github/workflows/publish-native-ts.yml index 8fd72ec..b0b25e9 100644 --- a/.github/workflows/publish-native-ts.yml +++ b/.github/workflows/publish-native-ts.yml @@ -19,10 +19,10 @@ jobs: with: fetch-depth: 0 - - name: Setup .NET 7 + - name: Setup .NET 8 uses: actions/setup-dotnet@master with: - dotnet-version: 7.x.x + dotnet-version: 8.x.x - run: dotnet publish -r win-x64 --self-contained -c Debug src/Bannerlord.ModuleManager.Native - run: dotnet publish -r win-x64 --self-contained -c Release src/Bannerlord.ModuleManager.Native diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index bcab8ed..a8b60a4 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -17,22 +17,17 @@ jobs: - uses: actions/checkout@v3.3.0 with: fetch-depth: 0 - - - name: Setup .NET 6 - uses: actions/setup-dotnet@master - with: - dotnet-version: 6.x.x - - - name: Setup .NET 7 + + - name: Setup .NET 8 uses: actions/setup-dotnet@master with: - dotnet-version: 7.x.x + dotnet-version: 8.x.x - - run: dotnet pack -c Release src/Bannerlord.ModuleManager -p:VersionOverride=$(git rev-list --no-merges --count master) -p:PackAsSource=false -o ./packages + - run: dotnet pack -c Release src/Bannerlord.ModuleManager -p:VersionOverride=$(git rev-list --no-merges --count master) -o ./packages - - run: dotnet pack -c Release src/Bannerlord.ModuleManager -p:VersionOverride=$(git rev-list --no-merges --count master) -p:PackAsSource=true -o ./packages + - run: dotnet pack -c Release src/Bannerlord.ModuleManager.Source -p:VersionOverride=$(git rev-list --no-merges --count master) -o ./packages - - run: dotnet pack -c Release src/Bannerlord.ModuleManager.Native -p:VersionOverride=$(git rev-list --no-merges --count master) -o ./packages + - run: dotnet pack -c Release src/Bannerlord.ModuleManager.DependencyInjection -p:VersionOverride=$(git rev-list --no-merges --count master) -o ./packages - name: Push to NuGet run: dotnet nuget push "./packages/*.nupkg" -k ${{secrets.NUGET_API_KEY}} -s https://www.nuget.org --skip-duplicate diff --git a/.github/workflows/publish-wasm.yml b/.github/workflows/publish-wasm.yml index f8cd029..67a715f 100644 --- a/.github/workflows/publish-wasm.yml +++ b/.github/workflows/publish-wasm.yml @@ -19,10 +19,10 @@ jobs: with: fetch-depth: 0 - - name: Setup .NET 7 + - name: Setup .NET 8 uses: actions/setup-dotnet@master with: - dotnet-version: 7.x.x + dotnet-version: 8.x.x - uses: actions/setup-node@v3.6.0 with: diff --git a/build/common.props b/build/common.props index 79467d4..6ae030e 100644 --- a/build/common.props +++ b/build/common.props @@ -1,5 +1,10 @@ + + + 0 + 5.0.$(VersionOverride) + @@ -19,7 +24,7 @@ - + diff --git a/src/Bannerlord.ModuleManager.DependencyInjection/Bannerlord.ModuleManager.DependencyInjection.csproj b/src/Bannerlord.ModuleManager.DependencyInjection/Bannerlord.ModuleManager.DependencyInjection.csproj new file mode 100644 index 0000000..ad5578e --- /dev/null +++ b/src/Bannerlord.ModuleManager.DependencyInjection/Bannerlord.ModuleManager.DependencyInjection.csproj @@ -0,0 +1,39 @@ + + + + netstandard2.0 + 10.0 + enable + + + + + BUTR + false + MIT + Butter.png + https://github.com/BUTR/Bannerlord.ModuleManager + https://github.com/BUTR/Bannerlord.ModuleManager.git + git + + + + Bannerlord.ModuleManager.DependencyInjection + DI for managing Mount & Blade 2: Bannerlord Module dependencies. + Bannerlord ModuleManager DependencyInjection + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.DependencyInjection/IModuleManager.cs b/src/Bannerlord.ModuleManager.DependencyInjection/IModuleManager.cs new file mode 100644 index 0000000..e42b960 --- /dev/null +++ b/src/Bannerlord.ModuleManager.DependencyInjection/IModuleManager.cs @@ -0,0 +1,32 @@ +using System.Collections.Generic; + +namespace Bannerlord.ModuleManager.DependencyInjection; + +public interface IModuleManager +{ + IList Sort(IReadOnlyCollection source); + IList Sort(IReadOnlyCollection source, ModuleSorterOptions options); + + bool AreDependenciesPresent(IReadOnlyCollection modules, ModuleInfoExtended module); + + IList GetDependencies(IReadOnlyCollection modules, ModuleInfoExtended module); + IList GetDependencies(IReadOnlyCollection modules, ModuleInfoExtended module, ModuleSorterOptions options); + + IList ValidateModule(IReadOnlyList modules, ModuleInfoExtended targetModule, IModuleManagerModuleViewModel provider); + IList ValidateLoadOrder(IReadOnlyList modules, ModuleInfoExtended targetModule); + + void EnableModule(IReadOnlyCollection modules, ModuleInfoExtended targetModule, IModuleManagerModuleViewModel provider); + void DisableModule(IReadOnlyCollection modules, ModuleInfoExtended targetModule, IModuleManagerModuleViewModel provider); + + ModuleInfoExtended? GetModuleInfo(string xml); + + SubModuleInfoExtended? GetSubModuleInfo(string xml); + + ApplicationVersion ParseApplicationVersion(string value); + int CompareVersions(ApplicationVersion x, ApplicationVersion y); + + IList GetDependenciesAll(ModuleInfoExtended moduleInfoExtended); + IList GetDependenciesLoadBeforeThis(ModuleInfoExtended moduleInfoExtended); + IList GetDependenciesLoadAfterThis(ModuleInfoExtended moduleInfoExtended); + IList GetDependenciesIncompatibles(ModuleInfoExtended moduleInfoExtended); +} \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.DependencyInjection/IModuleManagerModuleViewModel.cs b/src/Bannerlord.ModuleManager.DependencyInjection/IModuleManagerModuleViewModel.cs new file mode 100644 index 0000000..fd522f0 --- /dev/null +++ b/src/Bannerlord.ModuleManager.DependencyInjection/IModuleManagerModuleViewModel.cs @@ -0,0 +1,10 @@ +namespace Bannerlord.ModuleManager.DependencyInjection; + +public interface IModuleManagerModuleViewModel +{ + bool GetSelected(string moduleId); + void SetSelected(string moduleId, bool value); + + bool GetDisabled(string moduleId); + void SetDisabled(string moduleId, bool value); +} \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.DependencyInjection/ModuleManager.cs b/src/Bannerlord.ModuleManager.DependencyInjection/ModuleManager.cs new file mode 100644 index 0000000..5c5f23f --- /dev/null +++ b/src/Bannerlord.ModuleManager.DependencyInjection/ModuleManager.cs @@ -0,0 +1,74 @@ +using System.Collections.Generic; +using System.Linq; +using System.Xml; + +namespace Bannerlord.ModuleManager.DependencyInjection; + +public class ModuleManager : IModuleManager +{ + public IList Sort(IReadOnlyCollection source) => + ModuleSorter.Sort(source); + public IList Sort(IReadOnlyCollection source, ModuleSorterOptions options) => + ModuleSorter.Sort(source, options); + + public bool AreDependenciesPresent(IReadOnlyCollection modules, ModuleInfoExtended module) => + ModuleUtilities.AreDependenciesPresent(modules, module); + + public IList GetDependencies(IReadOnlyCollection modules, ModuleInfoExtended module) => + ModuleUtilities.GetDependencies(modules, module).ToList(); + public IList GetDependencies(IReadOnlyCollection modules, ModuleInfoExtended module, ModuleSorterOptions options) => + ModuleUtilities.GetDependencies(modules, module, options).ToList(); + + + public IList ValidateModule(IReadOnlyList modules, ModuleInfoExtended targetModule, IModuleManagerModuleViewModel provider) => + ModuleUtilities.ValidateModule(modules, targetModule, x => provider.GetSelected(x.Id)).ToList(); + + public IList ValidateLoadOrder(IReadOnlyList modules, ModuleInfoExtended targetModule) => + ModuleUtilities.ValidateLoadOrder(modules, targetModule).ToList(); + + public void EnableModule(IReadOnlyCollection modules, ModuleInfoExtended targetModule, IModuleManagerModuleViewModel provider) => + ModuleUtilities.EnableModule(modules, targetModule, x => provider.GetSelected(x.Id), (x, y) => provider.SetSelected(x.Id, y), x => provider.GetDisabled(x.Id), (x, y) => provider.SetDisabled(x.Id, y)); + + public void DisableModule(IReadOnlyCollection modules, ModuleInfoExtended targetModule, IModuleManagerModuleViewModel provider) => + ModuleUtilities.DisableModule(modules, targetModule, x => provider.GetSelected(x.Id), (x, y) => provider.SetSelected(x.Id, y), x => provider.GetDisabled(x.Id), (x, y) => provider.SetDisabled(x.Id, y)); + + public ModuleInfoExtended? GetModuleInfo(string xml) + { + try + { + var doc = new XmlDocument(); + doc.LoadXml(xml); + return ModuleInfoExtended.FromXml(doc); + } + catch { return null; } + } + + public SubModuleInfoExtended? GetSubModuleInfo(string xml) + { + try + { + var doc = new XmlDocument(); + doc.LoadXml(xml); + return SubModuleInfoExtended.FromXml(doc); + } + catch { return null; } + } + + public ApplicationVersion ParseApplicationVersion(string value) => + ApplicationVersion.TryParse(value, out var x) ? x : ApplicationVersion.Empty; + + public int CompareVersions(ApplicationVersion x, ApplicationVersion y) => + new ApplicationVersionComparer().Compare(x, y); + + public IList GetDependenciesAll(ModuleInfoExtended moduleInfoExtended) => + moduleInfoExtended.DependenciesAllDistinct().ToArray(); + + public IList GetDependenciesLoadBeforeThis(ModuleInfoExtended moduleInfoExtended) => + moduleInfoExtended.DependenciesLoadBeforeThisDistinct().ToArray(); + + public IList GetDependenciesLoadAfterThis(ModuleInfoExtended moduleInfoExtended) => + moduleInfoExtended.DependenciesLoadAfterThisDistinct().ToArray(); + + public IList GetDependenciesIncompatibles(ModuleInfoExtended moduleInfoExtended) => + moduleInfoExtended.DependenciesIncompatiblesDistinct().ToArray(); +} \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.DotNetJS/Bannerlord.ModuleManager.DotNetJS.csproj b/src/Bannerlord.ModuleManager.DotNetJS/Bannerlord.ModuleManager.DotNetJS.csproj index c479fe4..11700e7 100644 --- a/src/Bannerlord.ModuleManager.DotNetJS/Bannerlord.ModuleManager.DotNetJS.csproj +++ b/src/Bannerlord.ModuleManager.DotNetJS/Bannerlord.ModuleManager.DotNetJS.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Bannerlord.ModuleManager.DotNetJS/Program.cs b/src/Bannerlord.ModuleManager.DotNetJS/Program.cs index b8a534c..a6a7759 100644 --- a/src/Bannerlord.ModuleManager.DotNetJS/Program.cs +++ b/src/Bannerlord.ModuleManager.DotNetJS/Program.cs @@ -9,96 +9,95 @@ [assembly: JSNamespace("Bannerlord.ModuleManager.WASM", "Bannerlord.ModuleManager")] -namespace Bannerlord.ModuleManager.WASM +namespace Bannerlord.ModuleManager.WASM; + +public static class Program { - public static class Program + static Program() { - static Program() - { - JS.Runtime.ConfigureJson(options => options.Converters.Add(new JsonStringEnumConverter())); - } + JS.Runtime.ConfigureJson(options => options.Converters.Add(new JsonStringEnumConverter())); + } - public static void Main() { } + public static void Main() { } - [JSInvokable] - public static IList Sort(ModuleInfoExtended[] source) => - ModuleSorter.Sort(source); + [JSInvokable] + public static IList Sort(ModuleInfoExtended[] source) => + ModuleSorter.Sort(source); - [JSInvokable] - public static IList SortWithOptions(ModuleInfoExtended[] source, ModuleSorterOptions options) => - ModuleSorter.Sort(source, options); + [JSInvokable] + public static IList SortWithOptions(ModuleInfoExtended[] source, ModuleSorterOptions options) => + ModuleSorter.Sort(source, options); - [JSInvokable] - public static bool AreAllDependenciesOfModulePresent(ModuleInfoExtended[] source, ModuleInfoExtended module) => - ModuleUtilities.AreDependenciesPresent(source, module); + [JSInvokable] + public static bool AreAllDependenciesOfModulePresent(ModuleInfoExtended[] source, ModuleInfoExtended module) => + ModuleUtilities.AreDependenciesPresent(source, module); - [JSInvokable] - public static ModuleInfoExtended[] GetDependentModulesOf(ModuleInfoExtended[] source, ModuleInfoExtended module) => - ModuleUtilities.GetDependencies(source, module).ToArray(); + [JSInvokable] + public static ModuleInfoExtended[] GetDependentModulesOf(ModuleInfoExtended[] source, ModuleInfoExtended module) => + ModuleUtilities.GetDependencies(source, module).ToArray(); - [JSInvokable] - public static ModuleInfoExtended[] GetDependentModulesOfWithOptions(ModuleInfoExtended[] source, ModuleInfoExtended module, ModuleSorterOptions options) => - ModuleUtilities.GetDependencies(source, module, options).ToArray(); + [JSInvokable] + public static ModuleInfoExtended[] GetDependentModulesOfWithOptions(ModuleInfoExtended[] source, ModuleInfoExtended module, ModuleSorterOptions options) => + ModuleUtilities.GetDependencies(source, module, options).ToArray(); - [JSInvokable] - public static ModuleIssue[] ValidateModule(ModuleInfoExtended[] modules, ModuleInfoExtended targetModule, IJSUnmarshalledObjectReference manager) => - ModuleUtilities.ValidateModule(modules, targetModule, module => manager.Invoke("isSelected", module.Id)).ToArray(); + [JSInvokable] + public static ModuleIssue[] ValidateModule(ModuleInfoExtended[] modules, ModuleInfoExtended targetModule, IJSUnmarshalledObjectReference manager) => + ModuleUtilities.ValidateModule(modules, targetModule, module => manager.Invoke("isSelected", module.Id)).ToArray(); - [JSInvokable] - public static ModuleIssue[] ValidateLoadOrder(ModuleInfoExtended[] modules, ModuleInfoExtended targetModule) => - ModuleUtilities.ValidateLoadOrder(modules, targetModule).ToArray(); + [JSInvokable] + public static ModuleIssue[] ValidateLoadOrder(ModuleInfoExtended[] modules, ModuleInfoExtended targetModule) => + ModuleUtilities.ValidateLoadOrder(modules, targetModule).ToArray(); - [JSInvokable] - public static void EnableModule(ModuleInfoExtended[] modules, ModuleInfoExtended targetModule, IJSUnmarshalledObjectReference manager) => - ModuleUtilities.EnableModule(modules, targetModule, - module => manager.Invoke("getSelected", module.Id), (module, value) => manager.InvokeVoid("setSelected", module.Id, value), - module => manager.Invoke("getDisabled", module.Id), (module, value) => manager.InvokeVoid("setDisabled", module.Id, value)); + [JSInvokable] + public static void EnableModule(ModuleInfoExtended[] modules, ModuleInfoExtended targetModule, IJSUnmarshalledObjectReference manager) => + ModuleUtilities.EnableModule(modules, targetModule, + module => manager.Invoke("getSelected", module.Id), (module, value) => manager.InvokeVoid("setSelected", module.Id, value), + module => manager.Invoke("getDisabled", module.Id), (module, value) => manager.InvokeVoid("setDisabled", module.Id, value)); - [JSInvokable] - public static void DisableModule(ModuleInfoExtended[] modules, ModuleInfoExtended targetModule, IJSUnmarshalledObjectReference manager) => - ModuleUtilities.DisableModule(modules, targetModule, - module => manager.Invoke("getSelected", module.Id), (module, value) => manager.InvokeVoid("setSelected", module.Id, value), - module => manager.Invoke("getDisabled", module.Id), (module, value) => manager.InvokeVoid("setDisabled", module.Id, value)); + [JSInvokable] + public static void DisableModule(ModuleInfoExtended[] modules, ModuleInfoExtended targetModule, IJSUnmarshalledObjectReference manager) => + ModuleUtilities.DisableModule(modules, targetModule, + module => manager.Invoke("getSelected", module.Id), (module, value) => manager.InvokeVoid("setSelected", module.Id, value), + module => manager.Invoke("getDisabled", module.Id), (module, value) => manager.InvokeVoid("setDisabled", module.Id, value)); - [JSInvokable] - public static ModuleInfoExtended? GetModuleInfo(string xmlContent) + [JSInvokable] + public static ModuleInfoExtended? GetModuleInfo(string xmlContent) + { + try { - try - { - var doc = new XmlDocument(); - doc.LoadXml(xmlContent); - return ModuleInfoExtended.FromXml(doc); - } - catch { return null; } + var doc = new XmlDocument(); + doc.LoadXml(xmlContent); + return ModuleInfoExtended.FromXml(doc); } + catch { return null; } + } - [JSInvokable] - public static SubModuleInfoExtended? GetSubModuleInfo(string xmlContent) + [JSInvokable] + public static SubModuleInfoExtended? GetSubModuleInfo(string xmlContent) + { + try { - try - { - var doc = new XmlDocument(); - doc.LoadXml(xmlContent); - return SubModuleInfoExtended.FromXml(doc); - } - catch { return null; } + var doc = new XmlDocument(); + doc.LoadXml(xmlContent); + return SubModuleInfoExtended.FromXml(doc); } - - [JSInvokable] - public static int CompareVersions(ApplicationVersion x, ApplicationVersion y) => ApplicationVersionComparer.CompareStandard(x, y); - - [JSInvokable] - public static DependentModuleMetadata[] GetDependenciesAll(ModuleInfoExtended module) => module.DependenciesAllDistinct().ToArray(); - [JSInvokable] - public static DependentModuleMetadata[] GetDependenciesToLoadBeforeThis(ModuleInfoExtended module) => module.DependenciesLoadBeforeThisDistinct().ToArray(); - [JSInvokable] - public static DependentModuleMetadata[] GetDependenciesToLoadAfterThis(ModuleInfoExtended module) => module.DependenciesLoadAfterThisDistinct().ToArray(); - [JSInvokable] - public static DependentModuleMetadata[] GetDependenciesIncompatibles(ModuleInfoExtended module) => module.DependenciesIncompatiblesDistinct().ToArray(); + catch { return null; } } + + [JSInvokable] + public static int CompareVersions(ApplicationVersion x, ApplicationVersion y) => ApplicationVersionComparer.CompareStandard(x, y); + + [JSInvokable] + public static DependentModuleMetadata[] GetDependenciesAll(ModuleInfoExtended module) => module.DependenciesAllDistinct().ToArray(); + [JSInvokable] + public static DependentModuleMetadata[] GetDependenciesToLoadBeforeThis(ModuleInfoExtended module) => module.DependenciesLoadBeforeThisDistinct().ToArray(); + [JSInvokable] + public static DependentModuleMetadata[] GetDependenciesToLoadAfterThis(ModuleInfoExtended module) => module.DependenciesLoadAfterThisDistinct().ToArray(); + [JSInvokable] + public static DependentModuleMetadata[] GetDependenciesIncompatibles(ModuleInfoExtended module) => module.DependenciesIncompatiblesDistinct().ToArray(); } \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager/ApplicationVersion.cs b/src/Bannerlord.ModuleManager.Models/ApplicationVersion.cs similarity index 100% rename from src/Bannerlord.ModuleManager/ApplicationVersion.cs rename to src/Bannerlord.ModuleManager.Models/ApplicationVersion.cs diff --git a/src/Bannerlord.ModuleManager/ApplicationVersionComparer.cs b/src/Bannerlord.ModuleManager.Models/ApplicationVersionComparer.cs similarity index 100% rename from src/Bannerlord.ModuleManager/ApplicationVersionComparer.cs rename to src/Bannerlord.ModuleManager.Models/ApplicationVersionComparer.cs diff --git a/src/Bannerlord.ModuleManager/ApplicationVersionRange.cs b/src/Bannerlord.ModuleManager.Models/ApplicationVersionRange.cs similarity index 100% rename from src/Bannerlord.ModuleManager/ApplicationVersionRange.cs rename to src/Bannerlord.ModuleManager.Models/ApplicationVersionRange.cs diff --git a/src/Bannerlord.ModuleManager/ApplicationVersionType.cs b/src/Bannerlord.ModuleManager.Models/ApplicationVersionType.cs similarity index 100% rename from src/Bannerlord.ModuleManager/ApplicationVersionType.cs rename to src/Bannerlord.ModuleManager.Models/ApplicationVersionType.cs diff --git a/src/Bannerlord.ModuleManager.Models/Bannerlord.ModuleManager.Models.csproj b/src/Bannerlord.ModuleManager.Models/Bannerlord.ModuleManager.Models.csproj new file mode 100644 index 0000000..a53442e --- /dev/null +++ b/src/Bannerlord.ModuleManager.Models/Bannerlord.ModuleManager.Models.csproj @@ -0,0 +1,36 @@ + + + + netstandard2.0 + 10.0 + enable + $(DefineConstants);BANNERLORDBUTRMODULEMANAGER_PUBLIC;BANNERLORDBUTRMODULEMANAGER_ENABLE_WARNING;BANNERLORDBUTRMODULEMANAGER_NULLABLE; + + + + + BUTR + false + MIT + Butter.png + https://github.com/BUTR/Bannerlord.ModuleManager + https://github.com/BUTR/Bannerlord.ModuleManager.git + git + + + + Bannerlord.ModuleManager.Models + Models for managing Mount & Blade 2: Bannerlord Module dependencies. + Bannerlord ModuleManager Models + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager/DependentModule.cs b/src/Bannerlord.ModuleManager.Models/DependentModule.cs similarity index 100% rename from src/Bannerlord.ModuleManager/DependentModule.cs rename to src/Bannerlord.ModuleManager.Models/DependentModule.cs diff --git a/src/Bannerlord.ModuleManager/DependentModuleMetadata.cs b/src/Bannerlord.ModuleManager.Models/DependentModuleMetadata.cs similarity index 100% rename from src/Bannerlord.ModuleManager/DependentModuleMetadata.cs rename to src/Bannerlord.ModuleManager.Models/DependentModuleMetadata.cs diff --git a/src/Bannerlord.ModuleManager/LoadType.cs b/src/Bannerlord.ModuleManager.Models/LoadType.cs similarity index 100% rename from src/Bannerlord.ModuleManager/LoadType.cs rename to src/Bannerlord.ModuleManager.Models/LoadType.cs diff --git a/src/Bannerlord.ModuleManager/ModuleInfoExtended.cs b/src/Bannerlord.ModuleManager.Models/ModuleInfoExtended.cs similarity index 100% rename from src/Bannerlord.ModuleManager/ModuleInfoExtended.cs rename to src/Bannerlord.ModuleManager.Models/ModuleInfoExtended.cs diff --git a/src/Bannerlord.ModuleManager.Models/ModuleIssue.cs b/src/Bannerlord.ModuleManager.Models/ModuleIssue.cs new file mode 100644 index 0000000..3901c71 --- /dev/null +++ b/src/Bannerlord.ModuleManager.Models/ModuleIssue.cs @@ -0,0 +1,89 @@ +// +// This code file has automatically been added by the "Bannerlord.ModuleManager.Source" NuGet package (https://www.nuget.org/packages/Bannerlord.ModuleManager.Source). +// Please see https://github.com/BUTR/Bannerlord.ModuleManager for more information. +// +// IMPORTANT: +// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references. +// Consider migrating to PackageReferences instead: +// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference +// Migrating brings the following benefits: +// * The "Bannerlord.ModuleManager.Source" folder and the "ModuleIssue.cs" file don't appear in your project. +// * The added file is immutable and can therefore not be modified by coincidence. +// * Updating/Uninstalling the package will work flawlessly. +// + +#region License +// MIT License +// +// Copyright (c) Bannerlord's Unofficial Tools & Resources +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +#endregion + +#nullable enable +#if !BANNERLORDBUTRMODULEMANAGER_ENABLE_WARNING +#pragma warning disable +#endif + +namespace Bannerlord.ModuleManager +{ + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + +#if !BANNERLORDBUTRMODULEMANAGER_PUBLIC + internal +#else + public +# endif + sealed record ModuleIssue + { + public ModuleInfoExtended Target { get; set; } + public string SourceId { get; set; } + public ModuleIssueType Type { get; set; } + public string Reason { get; set; } + public ApplicationVersionRange SourceVersion { get; set; } + + public ModuleIssue() + { + Target = new(); + SourceId = string.Empty; + Type = ModuleIssueType.NONE; + Reason = string.Empty; + SourceVersion = ApplicationVersionRange.Empty; + } + public ModuleIssue(ModuleInfoExtended target, string sourceId, ModuleIssueType type) + { + Target = target; + SourceId = sourceId; + Type = type; + Reason = string.Empty; + SourceVersion = ApplicationVersionRange.Empty; + } + public ModuleIssue(ModuleInfoExtended target, string sourceId, ModuleIssueType type, string reason, ApplicationVersionRange sourceVersion) : this(target, sourceId, type) + { + Reason = reason; + SourceVersion = sourceVersion; + } + } +} +#nullable restore +#if !BANNERLORDBUTRMODULEMANAGER_ENABLE_WARNING +#pragma warning restore +#endif \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.Models/ModuleIssueType.cs b/src/Bannerlord.ModuleManager.Models/ModuleIssueType.cs new file mode 100644 index 0000000..f1ee691 --- /dev/null +++ b/src/Bannerlord.ModuleManager.Models/ModuleIssueType.cs @@ -0,0 +1,77 @@ +// +// This code file has automatically been added by the "Bannerlord.ModuleManager.Source" NuGet package (https://www.nuget.org/packages/Bannerlord.ModuleManager.Source). +// Please see https://github.com/BUTR/Bannerlord.ModuleManager for more information. +// +// IMPORTANT: +// DO NOT DELETE THIS FILE if you are using a "packages.config" file to manage your NuGet references. +// Consider migrating to PackageReferences instead: +// https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference +// Migrating brings the following benefits: +// * The "Bannerlord.ModuleManager.Source" folder and the "ModuleIssueType.cs" file don't appear in your project. +// * The added file is immutable and can therefore not be modified by coincidence. +// * Updating/Uninstalling the package will work flawlessly. +// + +#region License +// MIT License +// +// Copyright (c) Bannerlord's Unofficial Tools & Resources +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +#endregion + +#nullable enable +#if !BANNERLORDBUTRMODULEMANAGER_ENABLE_WARNING +#pragma warning disable +#endif + +namespace Bannerlord.ModuleManager +{ + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + +#if !BANNERLORDBUTRMODULEMANAGER_PUBLIC + internal +#else + public +# endif + enum ModuleIssueType + { + NONE, + Missing, + MissingDependencies, + DependencyMissingDependencies, + DependencyValidationError, + VersionMismatchLessThanOrEqual, + VersionMismatchLessThan, + VersionMismatchGreaterThan, + Incompatible, + DependencyConflictDependentAndIncompatible, + DependencyConflictDependentLoadBeforeAndAfter, + DependencyConflictCircular, + + DependencyNotLoadedBeforeThis, + DependencyNotLoadedAfterThis, + } +} +#nullable restore +#if !BANNERLORDBUTRMODULEMANAGER_ENABLE_WARNING +#pragma warning restore +#endif \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager/SubModuleInfoExtended.cs b/src/Bannerlord.ModuleManager.Models/SubModuleInfoExtended.cs similarity index 100% rename from src/Bannerlord.ModuleManager/SubModuleInfoExtended.cs rename to src/Bannerlord.ModuleManager.Models/SubModuleInfoExtended.cs diff --git a/src/Bannerlord.ModuleManager/SubModuleTags.cs b/src/Bannerlord.ModuleManager.Models/SubModuleTags.cs similarity index 100% rename from src/Bannerlord.ModuleManager/SubModuleTags.cs rename to src/Bannerlord.ModuleManager.Models/SubModuleTags.cs diff --git a/src/Bannerlord.ModuleManager.Native/Bannerlord.ModuleManager.Native.csproj b/src/Bannerlord.ModuleManager.Native/Bannerlord.ModuleManager.Native.csproj index 836bfb4..10eb830 100644 --- a/src/Bannerlord.ModuleManager.Native/Bannerlord.ModuleManager.Native.csproj +++ b/src/Bannerlord.ModuleManager.Native/Bannerlord.ModuleManager.Native.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 latest enable true diff --git a/src/Bannerlord.ModuleManager.Native/Bindings.Common.cs b/src/Bannerlord.ModuleManager.Native/Bindings.Common.cs index a4fcf16..630f8c6 100644 --- a/src/Bannerlord.ModuleManager.Native/Bindings.Common.cs +++ b/src/Bannerlord.ModuleManager.Native/Bindings.Common.cs @@ -3,20 +3,19 @@ using System.Text.Json.Serialization; using System.Text.Unicode; -namespace Bannerlord.ModuleManager.Native +namespace Bannerlord.ModuleManager.Native; + +public static partial class Bindings { - public static partial class Bindings + private static readonly JsonSerializerOptions _options = new() { - private static readonly JsonSerializerOptions _options = new() - { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, - IgnoreReadOnlyFields = true, - IgnoreReadOnlyProperties = true, - IncludeFields = false, - WriteIndented = false, - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - Encoder = JavaScriptEncoder.Create(UnicodeRanges.BasicLatin) - }; - internal static readonly SourceGenerationContext CustomSourceGenerationContext = new(_options); - } + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + IgnoreReadOnlyFields = true, + IgnoreReadOnlyProperties = true, + IncludeFields = false, + WriteIndented = false, + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + Encoder = JavaScriptEncoder.Create(UnicodeRanges.BasicLatin) + }; + internal static readonly SourceGenerationContext CustomSourceGenerationContext = new(_options); } \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.Native/Bindings.Shared.cs b/src/Bannerlord.ModuleManager.Native/Bindings.Shared.cs index 2e1445a..e3eaa26 100644 --- a/src/Bannerlord.ModuleManager.Native/Bindings.Shared.cs +++ b/src/Bannerlord.ModuleManager.Native/Bindings.Shared.cs @@ -4,64 +4,63 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -namespace Bannerlord.ModuleManager.Native +namespace Bannerlord.ModuleManager.Native; + +public static unsafe partial class Bindings { - public static unsafe partial class Bindings + [UnmanagedCallersOnly(EntryPoint = "common_alloc", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + public static void* CommonAlloc(nuint size) { - [UnmanagedCallersOnly(EntryPoint = "common_alloc", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static void* CommonAlloc(nuint size) + Logger.LogInput(size); + try { - Logger.LogInput(size); - try - { - var result = Allocator.Alloc(size); + var result = Allocator.Alloc(size); - Logger.LogOutput(new IntPtr(result).ToString("x16"), nameof(CommonAlloc)); - return result; - } - catch (Exception e) - { - Logger.LogException(e); - return null; - } + Logger.LogOutput(new IntPtr(result).ToString("x16"), nameof(CommonAlloc)); + return result; + } + catch (Exception e) + { + Logger.LogException(e); + return null; } + } - [UnmanagedCallersOnly(EntryPoint = "common_dealloc", CallConvs = new[] { typeof(CallConvCdecl) })] - public static void Common_Dealloc([IsConst] param_ptr* ptr) + [UnmanagedCallersOnly(EntryPoint = "common_dealloc", CallConvs = new[] { typeof(CallConvCdecl) })] + public static void Common_Dealloc([IsConst] param_ptr* ptr) + { + Logger.LogInput(new IntPtr(ptr).ToString("x16"), nameof(Common_Dealloc)); + try { - Logger.LogInput(new IntPtr(ptr).ToString("x16"), nameof(Common_Dealloc)); - try - { - Allocator.Free(ptr); + Allocator.Free(ptr); - Logger.LogOutput(); - } - catch (Exception e) - { - Logger.LogException(e); - } + Logger.LogOutput(); } + catch (Exception e) + { + Logger.LogException(e); + } + } - [UnmanagedCallersOnly(EntryPoint = "common_alloc_alive_count", CallConvs = new[] { typeof(CallConvCdecl) })] - public static int CommonAllocAliveCount() + [UnmanagedCallersOnly(EntryPoint = "common_alloc_alive_count", CallConvs = new[] { typeof(CallConvCdecl) })] + public static int CommonAllocAliveCount() + { + Logger.LogInput(); + try { - Logger.LogInput(); - try - { #if TRACK_ALLOCATIONS - var result = Allocator.GetCurrentAllocations(); + var result = Allocator.GetCurrentAllocations(); #else var result = 0; #endif - Logger.LogOutput(result); - return result; - } - catch (Exception e) - { - Logger.LogException(e); - return -1; - } + Logger.LogOutput(result); + return result; + } + catch (Exception e) + { + Logger.LogException(e); + return -1; } } } \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.Native/Bindings.cs b/src/Bannerlord.ModuleManager.Native/Bindings.cs index 4af2c9a..8fa9227 100644 --- a/src/Bannerlord.ModuleManager.Native/Bindings.cs +++ b/src/Bannerlord.ModuleManager.Native/Bindings.cs @@ -6,500 +6,499 @@ using System.Runtime.InteropServices; using System.Xml; -namespace Bannerlord.ModuleManager.Native +namespace Bannerlord.ModuleManager.Native; + +public static unsafe partial class Bindings { - public static unsafe partial class Bindings + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate return_value_bool* N_IsSelected(param_ptr* p_owner, param_string* p_module_id); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate return_value_bool* N_GetSelected(param_ptr* p_owner, param_string* p_module_id); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate return_value_void* N_SetSelected(param_ptr* p_owner, param_string* p_module_id, param_bool value); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate return_value_bool* N_GetDisabled(param_ptr* p_owner, param_string* p_module_id); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + private delegate return_value_void* N_SetDisabled(param_ptr* p_owner, param_string* p_module_id, param_bool value); + + [UnmanagedCallersOnly(EntryPoint = "bmm_sort", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + public static return_value_json* Sort([IsConst] param_json* p_source) { - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate return_value_bool* N_IsSelected(param_ptr* p_owner, param_string* p_module_id); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate return_value_bool* N_GetSelected(param_ptr* p_owner, param_string* p_module_id); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate return_value_void* N_SetSelected(param_ptr* p_owner, param_string* p_module_id, param_bool value); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate return_value_bool* N_GetDisabled(param_ptr* p_owner, param_string* p_module_id); - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate return_value_void* N_SetDisabled(param_ptr* p_owner, param_string* p_module_id, param_bool value); - - [UnmanagedCallersOnly(EntryPoint = "bmm_sort", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* Sort([IsConst] param_json* p_source) - { - Logger.LogInput(p_source); - try - { - var source = Utils.DeserializeJson(p_source, CustomSourceGenerationContext.ModuleInfoExtendedArray); + Logger.LogInput(p_source); + try + { + var source = Utils.DeserializeJson(p_source, CustomSourceGenerationContext.ModuleInfoExtendedArray); - var result = ModuleSorter.Sort(source).ToArray(); + var result = ModuleSorter.Sort(source).ToArray(); - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleInfoExtendedArray, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleInfoExtendedArray, false); + } + catch (Exception e) + { + Logger.LogException(e); + return return_value_json.AsException(e, false); } + } - [UnmanagedCallersOnly(EntryPoint = "bmm_sort_with_options", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* SortWithOptions([IsConst] param_json* p_source, [IsConst] param_json* p_options) + [UnmanagedCallersOnly(EntryPoint = "bmm_sort_with_options", CallConvs = new[] { 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); + try { - Logger.LogInput(p_source, p_options); - try - { - var source = Utils.DeserializeJson(p_source, CustomSourceGenerationContext.ModuleInfoExtendedArray); - var options = Utils.DeserializeJson(p_options, CustomSourceGenerationContext.ModuleSorterOptions); + var source = Utils.DeserializeJson(p_source, CustomSourceGenerationContext.ModuleInfoExtendedArray); + var options = Utils.DeserializeJson(p_options, CustomSourceGenerationContext.ModuleSorterOptions); - var result = ModuleSorter.Sort(source, options).ToArray(); + var result = ModuleSorter.Sort(source, options).ToArray(); - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleInfoExtendedArray, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleInfoExtendedArray, false); } + catch (Exception e) + { + Logger.LogException(e); + return return_value_json.AsException(e, false); + } + } - [UnmanagedCallersOnly(EntryPoint = "bmm_are_all_dependencies_of_module_present", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_bool* AreAllDependenciesOfModulePresent([IsConst] param_json* p_source, [IsConst] param_json* p_module) + [UnmanagedCallersOnly(EntryPoint = "bmm_are_all_dependencies_of_module_present", CallConvs = new[] { 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); + try { - Logger.LogInput(p_source, p_module); - try - { - var source = Utils.DeserializeJson(p_source, CustomSourceGenerationContext.ModuleInfoExtendedArray); - var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); + var source = Utils.DeserializeJson(p_source, CustomSourceGenerationContext.ModuleInfoExtendedArray); + var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); - var result = ModuleUtilities.AreDependenciesPresent(source, module); + var result = ModuleUtilities.AreDependenciesPresent(source, module); - Logger.LogOutput(result); - return return_value_bool.AsValue(result, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_bool.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_bool.AsValue(result, false); } + catch (Exception e) + { + Logger.LogException(e); + return return_value_bool.AsException(e, false); + } + } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependent_modules_of", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* GetDependentModulesOf([IsConst] param_json* p_source, [IsConst] param_json* p_module) + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependent_modules_of", CallConvs = new[] { 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); + try { - Logger.LogInput(p_source, p_module); - try - { - var source = Utils.DeserializeJson(p_source, CustomSourceGenerationContext.ModuleInfoExtendedArray); - var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); + var source = Utils.DeserializeJson(p_source, CustomSourceGenerationContext.ModuleInfoExtendedArray); + var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); - var result = ModuleUtilities.GetDependencies(source, module).ToArray(); + var result = ModuleUtilities.GetDependencies(source, module).ToArray(); - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleInfoExtendedArray, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleInfoExtendedArray, false); + } + catch (Exception e) + { + Logger.LogException(e); + return return_value_json.AsException(e, false); } + } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependent_modules_of_with_options", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* GetDependentModulesOfWithOptions([IsConst] param_json* p_source, [IsConst] param_json* p_module, [IsConst] param_json* p_options) + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependent_modules_of_with_options", CallConvs = new[] { 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); + try { - Logger.LogInput(p_source, p_module, p_options); - try - { - var source = Utils.DeserializeJson(p_source, CustomSourceGenerationContext.ModuleInfoExtendedArray); - var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); - var options = Utils.DeserializeJson(p_options, CustomSourceGenerationContext.ModuleSorterOptions); + var source = Utils.DeserializeJson(p_source, CustomSourceGenerationContext.ModuleInfoExtendedArray); + var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); + var options = Utils.DeserializeJson(p_options, CustomSourceGenerationContext.ModuleSorterOptions); - var result = ModuleUtilities.GetDependencies(source, module, options).ToArray(); + var result = ModuleUtilities.GetDependencies(source, module, options).ToArray(); - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleInfoExtendedArray, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleInfoExtendedArray, false); } + catch (Exception e) + { + Logger.LogException(e); + return return_value_json.AsException(e, false); + } + } - [UnmanagedCallersOnly(EntryPoint = "bmm_validate_module", CallConvs = new[] { 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) + [UnmanagedCallersOnly(EntryPoint = "bmm_validate_module", CallConvs = new[] { 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) + { + Logger.LogInput(p_modules, p_target_module); + try { - Logger.LogInput(p_modules, p_target_module); - try - { - var modules = Utils.DeserializeJson(p_modules, CustomSourceGenerationContext.ModuleInfoExtendedArray); - var targetModule = Utils.DeserializeJson(p_target_module, CustomSourceGenerationContext.ModuleInfoExtended); + var modules = Utils.DeserializeJson(p_modules, CustomSourceGenerationContext.ModuleInfoExtendedArray); + var targetModule = Utils.DeserializeJson(p_target_module, CustomSourceGenerationContext.ModuleInfoExtended); - var isSelected = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_is_selected)); + var isSelected = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_is_selected)); - var result = ModuleUtilities.ValidateModule(modules, targetModule, module => - { - Logger.LogInput(); - fixed (char* pModuleId = module.Id) - { - Logger.LogPinned(pModuleId); - - using var resultStr = SafeStructMallocHandle.Create(isSelected(p_owner, (param_string*) pModuleId), true); - var result = resultStr.ValueAsBool(); - Logger.LogOutput(result); - return result; - } - }).ToArray(); - - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleIssueArray, false); - } - catch (Exception e) + var result = ModuleUtilities.ValidateModule(modules, targetModule, module => { - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + Logger.LogInput(); + fixed (char* pModuleId = module.Id) + { + Logger.LogPinned(pModuleId); + + using var resultStr = SafeStructMallocHandle.Create(isSelected(p_owner, (param_string*) pModuleId), true); + var result = resultStr.ValueAsBool(); + Logger.LogOutput(result); + return result; + } + }).ToArray(); + + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleIssueArray, false); + } + catch (Exception e) + { + Logger.LogException(e); + return return_value_json.AsException(e, false); } + } - [UnmanagedCallersOnly(EntryPoint = "bmm_validate_load_order", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* ValidateLoadOrder([IsConst] param_json* p_modules, [IsConst] param_json* p_target_module) + [UnmanagedCallersOnly(EntryPoint = "bmm_validate_load_order", CallConvs = new[] { 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); + try { - Logger.LogInput(p_modules, p_target_module); - try - { - var modules = Utils.DeserializeJson(p_modules, CustomSourceGenerationContext.ModuleInfoExtendedArray); - var targetModule = Utils.DeserializeJson(p_target_module, CustomSourceGenerationContext.ModuleInfoExtended); + var modules = Utils.DeserializeJson(p_modules, CustomSourceGenerationContext.ModuleInfoExtendedArray); + var targetModule = Utils.DeserializeJson(p_target_module, CustomSourceGenerationContext.ModuleInfoExtended); - var result = ModuleUtilities.ValidateLoadOrder(modules, targetModule).ToArray(); + var result = ModuleUtilities.ValidateLoadOrder(modules, targetModule).ToArray(); - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleIssueArray, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleIssueArray, false); + } + catch (Exception e) + { + Logger.LogException(e); + return return_value_json.AsException(e, false); } + } - [UnmanagedCallersOnly(EntryPoint = "bmm_enable_module", CallConvs = new[] { 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, - [ConstMeta, IsConst, IsNotConst, IsNotConst>] - delegate* unmanaged[Cdecl] p_set_selected, - [ConstMeta, IsConst, IsNotConst>] - delegate* unmanaged[Cdecl] p_get_disabled, - [ConstMeta, IsConst, IsNotConst, IsNotConst>] - delegate* unmanaged[Cdecl] p_set_disabled) + [UnmanagedCallersOnly(EntryPoint = "bmm_enable_module", CallConvs = new[] { 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, + [ConstMeta, IsConst, IsNotConst, IsNotConst>] + delegate* unmanaged[Cdecl] p_set_selected, + [ConstMeta, IsConst, IsNotConst>] + delegate* unmanaged[Cdecl] p_get_disabled, + [ConstMeta, IsConst, IsNotConst, IsNotConst>] + delegate* unmanaged[Cdecl] p_set_disabled) + { + Logger.LogInput(p_module, p_target_module); + try { - Logger.LogInput(p_module, p_target_module); - try - { - var modules = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtendedArray); - var targetModule = Utils.DeserializeJson(p_target_module, CustomSourceGenerationContext.ModuleInfoExtended); + var modules = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtendedArray); + var targetModule = Utils.DeserializeJson(p_target_module, CustomSourceGenerationContext.ModuleInfoExtended); - var getSelected = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_selected)); - var setSelected = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_selected)); - var getDisabled = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_disabled)); - var setDisabled = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_disabled)); + var getSelected = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_selected)); + var setSelected = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_selected)); + var getDisabled = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_disabled)); + var setDisabled = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_disabled)); - ModuleUtilities.EnableModule(modules, targetModule, module => - { - Logger.LogInput(); - fixed (char* pModuleId = module.Id) - { - Logger.LogPinned(pModuleId); - - using var resultStr = SafeStructMallocHandle.Create(getSelected(p_owner, (param_string*) pModuleId), true); - var result = resultStr.ValueAsBool(); - Logger.LogOutput(result); - return result; - } - }, (module, value) => + ModuleUtilities.EnableModule(modules, targetModule, module => + { + Logger.LogInput(); + fixed (char* pModuleId = module.Id) { - Logger.LogInput(); - fixed (char* pModuleId = module.Id) - { - Logger.LogPinned(pModuleId); - - using var resultStr = SafeStructMallocHandle.Create(setSelected(p_owner, (param_string*) pModuleId, value), true); - resultStr.ValueAsVoid(); - Logger.LogOutput(); - } - }, module => + Logger.LogPinned(pModuleId); + + using var resultStr = SafeStructMallocHandle.Create(getSelected(p_owner, (param_string*) pModuleId), true); + var result = resultStr.ValueAsBool(); + Logger.LogOutput(result); + return result; + } + }, (module, value) => + { + Logger.LogInput(); + fixed (char* pModuleId = module.Id) { - Logger.LogInput(); - fixed (char* pModuleId = module.Id) - { - Logger.LogPinned(pModuleId); - - using var resultStr = SafeStructMallocHandle.Create(getDisabled(p_owner, (param_string*) pModuleId), true); - var result = resultStr.ValueAsBool(); - Logger.LogOutput(result); - return result; - } - }, (module, value) => + Logger.LogPinned(pModuleId); + + using var resultStr = SafeStructMallocHandle.Create(setSelected(p_owner, (param_string*) pModuleId, value), true); + resultStr.ValueAsVoid(); + Logger.LogOutput(); + } + }, module => + { + Logger.LogInput(); + fixed (char* pModuleId = module.Id) { - Logger.LogInput(); - fixed (char* pModuleId = module.Id) - { - Logger.LogPinned(pModuleId); - - using var resultStr = SafeStructMallocHandle.Create(setDisabled(p_owner, (param_string*) pModuleId, value), true); - resultStr.ValueAsVoid(); - Logger.LogOutput(); - } - }); - - Logger.LogOutput(); - return return_value_void.AsValue(false); - } - catch (Exception e) + Logger.LogPinned(pModuleId); + + using var resultStr = SafeStructMallocHandle.Create(getDisabled(p_owner, (param_string*) pModuleId), true); + var result = resultStr.ValueAsBool(); + Logger.LogOutput(result); + return result; + } + }, (module, value) => { - Logger.LogException(e); - return return_value_void.AsException(e, false); - } + Logger.LogInput(); + fixed (char* pModuleId = module.Id) + { + Logger.LogPinned(pModuleId); + + using var resultStr = SafeStructMallocHandle.Create(setDisabled(p_owner, (param_string*) pModuleId, value), true); + resultStr.ValueAsVoid(); + Logger.LogOutput(); + } + }); + + Logger.LogOutput(); + return return_value_void.AsValue(false); } + catch (Exception e) + { + Logger.LogException(e); + return return_value_void.AsException(e, false); + } + } - [UnmanagedCallersOnly(EntryPoint = "bmm_disable_module", CallConvs = new[] { 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, - [ConstMeta, IsConst, IsNotConst, IsNotConst>] - delegate* unmanaged[Cdecl] p_set_selected, - [ConstMeta, IsConst, IsNotConst>] - delegate* unmanaged[Cdecl] p_get_disabled, - [ConstMeta, IsConst, IsNotConst, IsNotConst>] - delegate* unmanaged[Cdecl] p_set_disabled) + [UnmanagedCallersOnly(EntryPoint = "bmm_disable_module", CallConvs = new[] { 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, + [ConstMeta, IsConst, IsNotConst, IsNotConst>] + delegate* unmanaged[Cdecl] p_set_selected, + [ConstMeta, IsConst, IsNotConst>] + delegate* unmanaged[Cdecl] p_get_disabled, + [ConstMeta, IsConst, IsNotConst, IsNotConst>] + delegate* unmanaged[Cdecl] p_set_disabled) + { + Logger.LogInput(p_module, p_target_module); + try { - Logger.LogInput(p_module, p_target_module); - try - { - var modules = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtendedArray); - var targetModule = Utils.DeserializeJson(p_target_module, CustomSourceGenerationContext.ModuleInfoExtended); + var modules = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtendedArray); + var targetModule = Utils.DeserializeJson(p_target_module, CustomSourceGenerationContext.ModuleInfoExtended); - var getSelected = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_selected)); - var setSelected = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_selected)); - var getDisabled = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_disabled)); - var setDisabled = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_disabled)); + var getSelected = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_selected)); + var setSelected = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_selected)); + var getDisabled = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_get_disabled)); + var setDisabled = Marshal.GetDelegateForFunctionPointer(new IntPtr(p_set_disabled)); - ModuleUtilities.DisableModule(modules, targetModule, module => - { - Logger.LogInput(); - fixed (char* pModuleId = module.Id) - { - Logger.LogPinned(pModuleId); - - using var resultStr = SafeStructMallocHandle.Create(getSelected(p_owner, (param_string*) pModuleId), true); - var result = resultStr.ValueAsBool(); - Logger.LogOutput(result); - return result; - } - }, (module, value) => + ModuleUtilities.DisableModule(modules, targetModule, module => + { + Logger.LogInput(); + fixed (char* pModuleId = module.Id) { - Logger.LogInput(); - fixed (char* pModuleId = module.Id) - { - Logger.LogPinned(pModuleId); - - using var resultStr = SafeStructMallocHandle.Create(setSelected(p_owner, (param_string*) pModuleId, value), true); - resultStr.ValueAsVoid(); - Logger.LogOutput(); - } - }, module => + Logger.LogPinned(pModuleId); + + using var resultStr = SafeStructMallocHandle.Create(getSelected(p_owner, (param_string*) pModuleId), true); + var result = resultStr.ValueAsBool(); + Logger.LogOutput(result); + return result; + } + }, (module, value) => + { + Logger.LogInput(); + fixed (char* pModuleId = module.Id) { - Logger.LogInput(); - fixed (char* pModuleId = module.Id) - { - Logger.LogPinned(pModuleId); - - using var resultStr = SafeStructMallocHandle.Create(getDisabled(p_owner, (param_string*) pModuleId), true); - var result = resultStr.ValueAsBool(); - Logger.LogOutput(result); - return result; - } - }, (module, value) => + Logger.LogPinned(pModuleId); + + using var resultStr = SafeStructMallocHandle.Create(setSelected(p_owner, (param_string*) pModuleId, value), true); + resultStr.ValueAsVoid(); + Logger.LogOutput(); + } + }, module => + { + Logger.LogInput(); + fixed (char* pModuleId = module.Id) { - Logger.LogInput(); - fixed (char* pModuleId = module.Id) - { - Logger.LogPinned(pModuleId); - - using var resultStr = SafeStructMallocHandle.Create(setDisabled(p_owner, (param_string*) pModuleId, value), true); - resultStr.ValueAsVoid(); - Logger.LogOutput(); - } - }); - - Logger.LogOutput(); - return return_value_void.AsValue(false); - } - catch (Exception e) + Logger.LogPinned(pModuleId); + + using var resultStr = SafeStructMallocHandle.Create(getDisabled(p_owner, (param_string*) pModuleId), true); + var result = resultStr.ValueAsBool(); + Logger.LogOutput(result); + return result; + } + }, (module, value) => { - Logger.LogException(e); - return return_value_void.AsException(e, false); - } - } + Logger.LogInput(); + fixed (char* pModuleId = module.Id) + { + Logger.LogPinned(pModuleId); + using var resultStr = SafeStructMallocHandle.Create(setDisabled(p_owner, (param_string*) pModuleId, value), true); + resultStr.ValueAsVoid(); + Logger.LogOutput(); + } + }); - [UnmanagedCallersOnly(EntryPoint = "bmm_get_module_info", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* GetModuleInfo([IsConst] param_string* p_xml_content) + Logger.LogOutput(); + return return_value_void.AsValue(false); + } + catch (Exception e) { - Logger.LogInput(p_xml_content); - try - { - var doc = new XmlDocument(); - doc.LoadXml(new string(param_string.ToSpan(p_xml_content))); + Logger.LogException(e); + return return_value_void.AsException(e, false); + } + } - var result = ModuleInfoExtended.FromXml(doc); - if (result is null) - { - var e = new InvalidOperationException("Invalid xml content!"); - Logger.LogException(e); - return return_value_json.AsException(e, false); - } - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleInfoExtended, false); - } - catch (Exception e) + [UnmanagedCallersOnly(EntryPoint = "bmm_get_module_info", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + public static return_value_json* GetModuleInfo([IsConst] param_string* p_xml_content) + { + Logger.LogInput(p_xml_content); + try + { + var doc = new XmlDocument(); + doc.LoadXml(new string(param_string.ToSpan(p_xml_content))); + + var result = ModuleInfoExtended.FromXml(doc); + if (result is null) { + var e = new InvalidOperationException("Invalid xml content!"); Logger.LogException(e); return return_value_json.AsException(e, false); } - } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_sub_module_info", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* GetSubModuleInfo([IsConst] param_string* p_xml_content) + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.ModuleInfoExtended, false); + } + catch (Exception e) { - Logger.LogInput(p_xml_content); - try - { - var doc = new XmlDocument(); - doc.LoadXml(new string(param_string.ToSpan(p_xml_content))); + Logger.LogException(e); + return return_value_json.AsException(e, false); + } + } - var result = SubModuleInfoExtended.FromXml(doc); - if (result is null) - { - var e = new InvalidOperationException("Invalid xml content!"); - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + [UnmanagedCallersOnly(EntryPoint = "bmm_get_sub_module_info", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + public static return_value_json* GetSubModuleInfo([IsConst] param_string* p_xml_content) + { + Logger.LogInput(p_xml_content); + try + { + var doc = new XmlDocument(); + doc.LoadXml(new string(param_string.ToSpan(p_xml_content))); - return return_value_json.AsValue(result, CustomSourceGenerationContext.SubModuleInfoExtended, false); - } - catch (Exception e) + var result = SubModuleInfoExtended.FromXml(doc); + if (result is null) { + var e = new InvalidOperationException("Invalid xml content!"); Logger.LogException(e); return return_value_json.AsException(e, false); } + + return return_value_json.AsValue(result, CustomSourceGenerationContext.SubModuleInfoExtended, false); } + catch (Exception e) + { + Logger.LogException(e); + return return_value_json.AsException(e, false); + } + } - [UnmanagedCallersOnly(EntryPoint = "bmm_compare_versions", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_int32* CompareVersions([IsConst] param_json* p_x, [IsConst] param_json* p_y) + [UnmanagedCallersOnly(EntryPoint = "bmm_compare_versions", CallConvs = new[] { 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); + try { - Logger.LogInput(p_x, p_y); - try - { - var x = Utils.DeserializeJson(p_x, CustomSourceGenerationContext.ApplicationVersion); - var y = Utils.DeserializeJson(p_y, CustomSourceGenerationContext.ApplicationVersion); + var x = Utils.DeserializeJson(p_x, CustomSourceGenerationContext.ApplicationVersion); + var y = Utils.DeserializeJson(p_y, CustomSourceGenerationContext.ApplicationVersion); - var result = ApplicationVersionComparer.CompareStandard(x, y); + var result = ApplicationVersionComparer.CompareStandard(x, y); - Logger.LogOutput(result); - return return_value_int32.AsValue(result, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_int32.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_int32.AsValue(result, false); + } + catch (Exception e) + { + Logger.LogException(e); + return return_value_int32.AsException(e, false); } + } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_all", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* GetDependenciesAll([IsConst] param_json* p_module) + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_all", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + public static return_value_json* GetDependenciesAll([IsConst] param_json* p_module) + { + Logger.LogInput(p_module); + try { - Logger.LogInput(p_module); - try - { - var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); + var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); - var result = module.DependenciesAllDistinct().ToArray(); + var result = module.DependenciesAllDistinct().ToArray(); - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.DependentModuleMetadataArray, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.DependentModuleMetadataArray, false); } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_load_before_this", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* GetDependenciesLoadBeforeThis([IsConst] param_json* p_module) + catch (Exception e) { - Logger.LogInput(p_module); - try - { - var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); + Logger.LogException(e); + return return_value_json.AsException(e, false); + } + } + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_load_before_this", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + public static return_value_json* GetDependenciesLoadBeforeThis([IsConst] param_json* p_module) + { + Logger.LogInput(p_module); + try + { + var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); - var result = module.DependenciesLoadBeforeThisDistinct().ToArray(); + var result = module.DependenciesLoadBeforeThisDistinct().ToArray(); - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.DependentModuleMetadataArray, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.DependentModuleMetadataArray, false); } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_load_after_this", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* GetDependenciesLoadAfterThis([IsConst] param_json* p_module) + catch (Exception e) { - Logger.LogInput(p_module); - try - { - var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); + Logger.LogException(e); + return return_value_json.AsException(e, false); + } + } + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_load_after_this", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + public static return_value_json* GetDependenciesLoadAfterThis([IsConst] param_json* p_module) + { + Logger.LogInput(p_module); + try + { + var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); - var result = module.DependenciesLoadAfterThisDistinct().ToArray(); + var result = module.DependenciesLoadAfterThisDistinct().ToArray(); - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.DependentModuleMetadataArray, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.DependentModuleMetadataArray, false); } - [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_incompatibles", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] - public static return_value_json* GetDependenciesIncompatibles([IsConst] param_json* p_module) + catch (Exception e) { - Logger.LogInput(p_module); - try - { - var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); + Logger.LogException(e); + return return_value_json.AsException(e, false); + } + } + [UnmanagedCallersOnly(EntryPoint = "bmm_get_dependencies_incompatibles", CallConvs = new[] { typeof(CallConvCdecl) }), IsNotConst] + public static return_value_json* GetDependenciesIncompatibles([IsConst] param_json* p_module) + { + Logger.LogInput(p_module); + try + { + var module = Utils.DeserializeJson(p_module, CustomSourceGenerationContext.ModuleInfoExtended); - var result = module.DependenciesIncompatiblesDistinct().ToArray(); + var result = module.DependenciesIncompatiblesDistinct().ToArray(); - Logger.LogOutput(result); - return return_value_json.AsValue(result, CustomSourceGenerationContext.DependentModuleMetadataArray, false); - } - catch (Exception e) - { - Logger.LogException(e); - return return_value_json.AsException(e, false); - } + Logger.LogOutput(result); + return return_value_json.AsValue(result, CustomSourceGenerationContext.DependentModuleMetadataArray, false); + } + catch (Exception e) + { + Logger.LogException(e); + return return_value_json.AsException(e, false); } } } \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.Native/Logger.cs b/src/Bannerlord.ModuleManager.Native/Logger.cs index 7134e2b..502ad56 100644 --- a/src/Bannerlord.ModuleManager.Native/Logger.cs +++ b/src/Bannerlord.ModuleManager.Native/Logger.cs @@ -11,141 +11,140 @@ using System.Text.Json.Serialization.Metadata; using System.Threading; -namespace Bannerlord.ModuleManager.Native +namespace Bannerlord.ModuleManager.Native; + +public static class Logger { - public static class Logger + [Conditional("LOGGING")] + public static void LogInput([CallerMemberName] string? caller = null) { - [Conditional("LOGGING")] - public static void LogInput([CallerMemberName] string? caller = null) - { - Log($"{caller} - Starting"); - } - [Conditional("LOGGING")] - public static void LogInput(string param, [CallerMemberName] string? caller = null) - { - Log($"{caller} - Starting: {param}"); - } - [Conditional("LOGGING")] - public static void LogInput(T1 param1, [CallerMemberName] string? caller = null) - where T1 : IFormattable - { - Log($"{caller} - Starting: {param1.ToString(null, CultureInfo.InvariantCulture)}"); - } - [Conditional("LOGGING")] - public static unsafe void LogInput(T1* param1, [CallerMemberName] string? caller = null) - where T1 : unmanaged, IParameterSpanFormattable - { - Log($"{caller} - Starting: {T1.ToSpan(param1)}"); - } - [Conditional("LOGGING")] - public static unsafe void LogInput(T1* param1, T2* param2, [CallerMemberName] string? caller = null) - where T1 : unmanaged, IParameterSpanFormattable - where T2 : unmanaged, IParameterSpanFormattable - { - Log($"{caller} - Starting: {T1.ToSpan(param1)}; {T2.ToSpan(param2)}"); - } - [Conditional("LOGGING")] - public static unsafe void LogInput(T1* param1, T2* param2, T3* param3, [CallerMemberName] string? caller = null) - where T1 : unmanaged, IParameterSpanFormattable - where T2 : unmanaged, IParameterSpanFormattable - where T3 : unmanaged, IParameterSpanFormattable - { - Log($"{caller} - Starting: {T1.ToSpan(param1)}; {T2.ToSpan(param2)}; {T3.ToSpan(param3)}"); - } - [Conditional("LOGGING")] - public static unsafe void LogInput(T1* param1, T2* param2, T3* param3, T4* param4, [CallerMemberName] string? caller = null) - where T1 : unmanaged, IParameterSpanFormattable - where T2 : unmanaged, IParameterSpanFormattable - where T3 : unmanaged, IParameterSpanFormattable - where T4 : unmanaged, IParameterSpanFormattable - { - Log($"{caller} - Starting: {T1.ToSpan(param1)}; {T2.ToSpan(param2)}; {T3.ToSpan(param3)}; {T4.ToSpan(param4)}"); - } + Log($"{caller} - Starting"); + } + [Conditional("LOGGING")] + public static void LogInput(string param, [CallerMemberName] string? caller = null) + { + Log($"{caller} - Starting: {param}"); + } + [Conditional("LOGGING")] + public static void LogInput(T1 param1, [CallerMemberName] string? caller = null) + where T1 : IFormattable + { + Log($"{caller} - Starting: {param1.ToString(null, CultureInfo.InvariantCulture)}"); + } + [Conditional("LOGGING")] + public static unsafe void LogInput(T1* param1, [CallerMemberName] string? caller = null) + where T1 : unmanaged, IParameterSpanFormattable + { + Log($"{caller} - Starting: {T1.ToSpan(param1)}"); + } + [Conditional("LOGGING")] + public static unsafe void LogInput(T1* param1, T2* param2, [CallerMemberName] string? caller = null) + where T1 : unmanaged, IParameterSpanFormattable + where T2 : unmanaged, IParameterSpanFormattable + { + Log($"{caller} - Starting: {T1.ToSpan(param1)}; {T2.ToSpan(param2)}"); + } + [Conditional("LOGGING")] + public static unsafe void LogInput(T1* param1, T2* param2, T3* param3, [CallerMemberName] string? caller = null) + where T1 : unmanaged, IParameterSpanFormattable + where T2 : unmanaged, IParameterSpanFormattable + where T3 : unmanaged, IParameterSpanFormattable + { + Log($"{caller} - Starting: {T1.ToSpan(param1)}; {T2.ToSpan(param2)}; {T3.ToSpan(param3)}"); + } + [Conditional("LOGGING")] + public static unsafe void LogInput(T1* param1, T2* param2, T3* param3, T4* param4, [CallerMemberName] string? caller = null) + where T1 : unmanaged, IParameterSpanFormattable + where T2 : unmanaged, IParameterSpanFormattable + where T3 : unmanaged, IParameterSpanFormattable + where T4 : unmanaged, IParameterSpanFormattable + { + Log($"{caller} - Starting: {T1.ToSpan(param1)}; {T2.ToSpan(param2)}; {T3.ToSpan(param3)}; {T4.ToSpan(param4)}"); + } - [Conditional("LOGGING")] - public static unsafe void LogPinned(char* param1, [CallerMemberName] string? caller = null) - { - var p1 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param1); - Log($"{caller} - Pinned: {p1}"); - } - [Conditional("LOGGING")] - public static unsafe void LogPinned(char* param1, char* param2, [CallerMemberName] string? caller = null) - { - var p1 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param1); - var p2 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param2); - Log($"{caller} - Pinned: {p1}; {p2}"); - } - [Conditional("LOGGING")] - public static unsafe void LogPinned(char* param1, char* param2, char* param3, [CallerMemberName] string? caller = null) - { - var p1 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param1); - var p2 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param2); - var p3 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param3); - Log($"{caller} - Pinned: {p1}; {p2}; {p3}"); - } - [Conditional("LOGGING")] - public static unsafe void LogPinned(char* param1, char* param2, char* param3, char* param4, [CallerMemberName] string? caller = null) - { - var p1 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param1); - var p2 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param2); - var p3 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param3); - var p4 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param4); - Log($"{caller} - Pinned: {p1}; {p2}; {p3}; {p4}"); - } + [Conditional("LOGGING")] + public static unsafe void LogPinned(char* param1, [CallerMemberName] string? caller = null) + { + var p1 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param1); + Log($"{caller} - Pinned: {p1}"); + } + [Conditional("LOGGING")] + public static unsafe void LogPinned(char* param1, char* param2, [CallerMemberName] string? caller = null) + { + var p1 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param1); + var p2 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param2); + Log($"{caller} - Pinned: {p1}; {p2}"); + } + [Conditional("LOGGING")] + public static unsafe void LogPinned(char* param1, char* param2, char* param3, [CallerMemberName] string? caller = null) + { + var p1 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param1); + var p2 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param2); + var p3 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param3); + Log($"{caller} - Pinned: {p1}; {p2}; {p3}"); + } + [Conditional("LOGGING")] + public static unsafe void LogPinned(char* param1, char* param2, char* param3, char* param4, [CallerMemberName] string? caller = null) + { + var p1 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param1); + var p2 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param2); + var p3 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param3); + var p4 = MemoryMarshal.CreateReadOnlySpanFromNullTerminated(param4); + Log($"{caller} - Pinned: {p1}; {p2}; {p3}; {p4}"); + } - [Conditional("LOGGING")] - public static void LogOutput([CallerMemberName] string? caller = null) - { - Log($"{caller} - Finished"); - } - [Conditional("LOGGING")] - public static void LogOutput(string param, [CallerMemberName] string? caller = null) - { - Log($"{caller} - Finished: {param}"); - } - [Conditional("LOGGING")] - public static void LogOutput(T1 result, [CallerMemberName] string? caller = null) - { - if (Bindings.CustomSourceGenerationContext.GetTypeInfo(typeof(T1)) is JsonTypeInfo jsonTypeInfo) - Log($"{caller} - Finished: JSON - {JsonSerializer.Serialize(result, jsonTypeInfo)}"); - else - Log($"{caller} - Finished: RAW - {result?.ToString()}"); - } - [Conditional("LOGGING")] - public static void LogOutput(bool result, [CallerMemberName] string? caller = null) - { - Log($"{caller} - Finished: {result}"); - } + [Conditional("LOGGING")] + public static void LogOutput([CallerMemberName] string? caller = null) + { + Log($"{caller} - Finished"); + } + [Conditional("LOGGING")] + public static void LogOutput(string param, [CallerMemberName] string? caller = null) + { + Log($"{caller} - Finished: {param}"); + } + [Conditional("LOGGING")] + public static void LogOutput(T1 result, [CallerMemberName] string? caller = null) + { + if (Bindings.CustomSourceGenerationContext.GetTypeInfo(typeof(T1)) is JsonTypeInfo jsonTypeInfo) + Log($"{caller} - Finished: JSON - {JsonSerializer.Serialize(result, jsonTypeInfo)}"); + else + Log($"{caller} - Finished: RAW - {result?.ToString()}"); + } + [Conditional("LOGGING")] + public static void LogOutput(bool result, [CallerMemberName] string? caller = null) + { + Log($"{caller} - Finished: {result}"); + } - [Conditional("LOGGING")] - public static void LogException(Exception e, [CallerMemberName] string? caller = null) - { - Log($"{caller} - Exception: {e}"); - } + [Conditional("LOGGING")] + public static void LogException(Exception e, [CallerMemberName] string? caller = null) + { + Log($"{caller} - Exception: {e}"); + } - private static readonly ReaderWriterLock _lock = new(); - private static void Log(string message) + private static readonly ReaderWriterLock _lock = new(); + private static void Log(string message) + { + while (true) { - while (true) + try { - try - { - _lock.AcquireWriterLock(100); + _lock.AcquireWriterLock(100); - try - { - using var fs = new FileStream("Bannerlord.VortexExtension.Native.log", FileMode.Append, FileAccess.Write, FileShare.Read, 4096, FileOptions.SequentialScan); - using var sw = new StreamWriter(fs, Encoding.UTF8, -1, true); - sw.WriteLine(message); - return; - } - finally - { - _lock.ReleaseWriterLock(); - } + try + { + using var fs = new FileStream("Bannerlord.VortexExtension.Native.log", FileMode.Append, FileAccess.Write, FileShare.Read, 4096, FileOptions.SequentialScan); + using var sw = new StreamWriter(fs, Encoding.UTF8, -1, true); + sw.WriteLine(message); + return; + } + finally + { + _lock.ReleaseWriterLock(); } - catch (Exception) { /* ignored */ } } + catch (Exception) { /* ignored */ } } } } \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.Native/SourceGenerationContext.cs b/src/Bannerlord.ModuleManager.Native/SourceGenerationContext.cs index fc4c26d..98b4c01 100644 --- a/src/Bannerlord.ModuleManager.Native/SourceGenerationContext.cs +++ b/src/Bannerlord.ModuleManager.Native/SourceGenerationContext.cs @@ -1,14 +1,13 @@ using System.Text.Json.Serialization; -namespace Bannerlord.ModuleManager.Native -{ - [JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Default)] - [JsonSerializable(typeof(ApplicationVersion))] - [JsonSerializable(typeof(SubModuleInfoExtended))] - [JsonSerializable(typeof(ModuleInfoExtended))] - [JsonSerializable(typeof(ModuleInfoExtended[]))] - [JsonSerializable(typeof(ModuleSorterOptions))] - [JsonSerializable(typeof(ModuleIssue[]))] - [JsonSerializable(typeof(DependentModuleMetadata[]))] - internal partial class SourceGenerationContext : JsonSerializerContext { } -} \ No newline at end of file +namespace Bannerlord.ModuleManager.Native; + +[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Default)] +[JsonSerializable(typeof(ApplicationVersion))] +[JsonSerializable(typeof(SubModuleInfoExtended))] +[JsonSerializable(typeof(ModuleInfoExtended))] +[JsonSerializable(typeof(ModuleInfoExtended[]))] +[JsonSerializable(typeof(ModuleSorterOptions))] +[JsonSerializable(typeof(ModuleIssue[]))] +[JsonSerializable(typeof(DependentModuleMetadata[]))] +internal partial class SourceGenerationContext : JsonSerializerContext { } \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.Source/Bannerlord.ModuleManager.Source.csproj b/src/Bannerlord.ModuleManager.Source/Bannerlord.ModuleManager.Source.csproj new file mode 100644 index 0000000..f6bfb36 --- /dev/null +++ b/src/Bannerlord.ModuleManager.Source/Bannerlord.ModuleManager.Source.csproj @@ -0,0 +1,54 @@ + + + + netstandard2.0 + 10.0 + enable + $(DefineConstants);BANNERLORDBUTRMODULEMANAGER_PUBLIC;BANNERLORDBUTRMODULEMANAGER_ENABLE_WARNING;BANNERLORDBUTRMODULEMANAGER_NULLABLE; + Bannerlord.ModuleManager + + + + + BUTR + false + MIT + Butter.png + https://github.com/BUTR/Bannerlord.ModuleManager + https://github.com/BUTR/Bannerlord.ModuleManager.git + git + + + + Bannerlord.ModuleManager.Source + Source code for managing Mount & Blade 2: Bannerlord Module dependencies. + Bannerlord ModuleManager Source + true + false + false + false + false + true + true + false + false + obj + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager.Tests/Bannerlord.ModuleManager.Tests.csproj b/src/Bannerlord.ModuleManager.Tests/Bannerlord.ModuleManager.Tests.csproj index 65239a4..c07cc97 100644 --- a/src/Bannerlord.ModuleManager.Tests/Bannerlord.ModuleManager.Tests.csproj +++ b/src/Bannerlord.ModuleManager.Tests/Bannerlord.ModuleManager.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable false @@ -15,7 +15,6 @@ - diff --git a/src/Bannerlord.ModuleManager.sln b/src/Bannerlord.ModuleManager.sln index 56f2da5..188b716 100644 --- a/src/Bannerlord.ModuleManager.sln +++ b/src/Bannerlord.ModuleManager.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bannerlord.ModuleManager", "Bannerlord.ModuleManager\Bannerlord.ModuleManager.csproj", "{F9F1C4C6-93E8-4FA4-86CE-A840842D0DA2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bannerlord.ModuleManager.Source", "Bannerlord.ModuleManager.Source\Bannerlord.ModuleManager.Source.csproj", "{F9F1C4C6-93E8-4FA4-86CE-A840842D0DA2}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bannerlord.ModuleManager.WASM", "Bannerlord.ModuleManager.WASM\Bannerlord.ModuleManager.WASM.csproj", "{6628D1C9-6234-493F-A240-F0B40024783E}" EndProject @@ -37,6 +37,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bannerlord.ModuleManager.Do EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{FBDA325F-819E-4771-8FE1-15497B134C4A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bannerlord.ModuleManager.DependencyInjection", "Bannerlord.ModuleManager.DependencyInjection\Bannerlord.ModuleManager.DependencyInjection.csproj", "{62236515-1E3E-4FC2-B573-B04ACF6DBB80}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bannerlord.ModuleManager.Models", "Bannerlord.ModuleManager.Models\Bannerlord.ModuleManager.Models.csproj", "{B3F74AF9-9185-42DD-BCF8-89BA1CA4D5F2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bannerlord.ModuleManager", "Bannerlord.ModuleManager\Bannerlord.ModuleManager.csproj", "{7263DA30-444A-44F5-ADB0-E5699AA983AC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -67,6 +73,18 @@ Global {3F49CC2C-D5A7-4C5F-A4C3-2F98CBF6461B}.Debug|Any CPU.Build.0 = Debug|Any CPU {3F49CC2C-D5A7-4C5F-A4C3-2F98CBF6461B}.Release|Any CPU.ActiveCfg = Release|Any CPU {3F49CC2C-D5A7-4C5F-A4C3-2F98CBF6461B}.Release|Any CPU.Build.0 = Release|Any CPU + {62236515-1E3E-4FC2-B573-B04ACF6DBB80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62236515-1E3E-4FC2-B573-B04ACF6DBB80}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62236515-1E3E-4FC2-B573-B04ACF6DBB80}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62236515-1E3E-4FC2-B573-B04ACF6DBB80}.Release|Any CPU.Build.0 = Release|Any CPU + {B3F74AF9-9185-42DD-BCF8-89BA1CA4D5F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B3F74AF9-9185-42DD-BCF8-89BA1CA4D5F2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B3F74AF9-9185-42DD-BCF8-89BA1CA4D5F2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B3F74AF9-9185-42DD-BCF8-89BA1CA4D5F2}.Release|Any CPU.Build.0 = Release|Any CPU + {7263DA30-444A-44F5-ADB0-E5699AA983AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7263DA30-444A-44F5-ADB0-E5699AA983AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7263DA30-444A-44F5-ADB0-E5699AA983AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7263DA30-444A-44F5-ADB0-E5699AA983AC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -82,6 +100,9 @@ Global {FBDA325F-819E-4771-8FE1-15497B134C4A} = {2D0B1C0E-1519-47CD-96AA-728A6A1F6BC0} {74074D6D-EF2B-4575-9A1F-839EEEBEDAE4} = {FBDA325F-819E-4771-8FE1-15497B134C4A} {C31AFBA4-016A-429B-B448-F4311A2151C5} = {FBDA325F-819E-4771-8FE1-15497B134C4A} + {62236515-1E3E-4FC2-B573-B04ACF6DBB80} = {8F14632F-6637-4E24-9C0E-D776516D4AC1} + {B3F74AF9-9185-42DD-BCF8-89BA1CA4D5F2} = {8F14632F-6637-4E24-9C0E-D776516D4AC1} + {7263DA30-444A-44F5-ADB0-E5699AA983AC} = {8F14632F-6637-4E24-9C0E-D776516D4AC1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {5E629D17-E1D7-4E87-88BE-55D34F95D796} diff --git a/src/Bannerlord.ModuleManager/Bannerlord.ModuleManager.csproj b/src/Bannerlord.ModuleManager/Bannerlord.ModuleManager.csproj index ff0d5e3..0993789 100644 --- a/src/Bannerlord.ModuleManager/Bannerlord.ModuleManager.csproj +++ b/src/Bannerlord.ModuleManager/Bannerlord.ModuleManager.csproj @@ -4,9 +4,8 @@ netstandard2.0 10.0 enable - 0 - 5.0.$(VersionOverride) $(DefineConstants);BANNERLORDBUTRMODULEMANAGER_PUBLIC;BANNERLORDBUTRMODULEMANAGER_ENABLE_WARNING;BANNERLORDBUTRMODULEMANAGER_NULLABLE; + Bannerlord.ModuleManager @@ -20,44 +19,23 @@ git - + Bannerlord.ModuleManager A library for managing Mount & Blade 2: Bannerlord Module dependencies. Bannerlord ModuleManager - + + - - Bannerlord.ModuleManager.Source - Source code for managing Mount & Blade 2: Bannerlord Module dependencies. - Bannerlord ModuleManager Source - true - false - false - false - false - true - true - false - false - obj - - - - - - - - - - + + + + \ No newline at end of file diff --git a/src/Bannerlord.ModuleManager/ModuleUtilities.cs b/src/Bannerlord.ModuleManager/ModuleUtilities.cs index b86128c..4ee46e1 100644 --- a/src/Bannerlord.ModuleManager/ModuleUtilities.cs +++ b/src/Bannerlord.ModuleManager/ModuleUtilities.cs @@ -47,66 +47,6 @@ namespace Bannerlord.ModuleManager using global::System.Collections.Generic; using global::System.Linq; -#if !BANNERLORDBUTRMODULEMANAGER_PUBLIC - internal -#else - public -# endif - sealed record ModuleIssue - { - public ModuleInfoExtended Target { get; set; } - public string SourceId { get; set; } - public ModuleIssueType Type { get; set; } - public string Reason { get; set; } - public ApplicationVersionRange SourceVersion { get; set; } - - public ModuleIssue() - { - Target = new(); - SourceId = string.Empty; - Type = ModuleIssueType.NONE; - Reason = string.Empty; - SourceVersion = ApplicationVersionRange.Empty; - } - public ModuleIssue(ModuleInfoExtended target, string sourceId, ModuleIssueType type) - { - Target = target; - SourceId = sourceId; - Type = type; - Reason = string.Empty; - SourceVersion = ApplicationVersionRange.Empty; - } - public ModuleIssue(ModuleInfoExtended target, string sourceId, ModuleIssueType type, string reason, ApplicationVersionRange sourceVersion) : this(target, sourceId, type) - { - Reason = reason; - SourceVersion = sourceVersion; - } - } - -#if !BANNERLORDBUTRMODULEMANAGER_PUBLIC - internal -#else - public -# endif - enum ModuleIssueType - { - NONE, - Missing, - MissingDependencies, - DependencyMissingDependencies, - DependencyValidationError, - VersionMismatchLessThanOrEqual, - VersionMismatchLessThan, - VersionMismatchGreaterThan, - Incompatible, - DependencyConflictDependentAndIncompatible, - DependencyConflictDependentLoadBeforeAndAfter, - DependencyConflictCircular, - - DependencyNotLoadedBeforeThis, - DependencyNotLoadedAfterThis, - } - #if !BANNERLORDBUTRMODULEMANAGER_PUBLIC internal #else