From b41c7b828b2ad07b1e3b23912496155e66d1c389 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Fri, 7 Apr 2023 17:24:13 +0300 Subject: [PATCH 01/15] Fix --- .../Bannerlord.ButterLib.Implementation.csproj | 2 +- src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj | 2 +- .../Bannerlord.ButterLib.HotKeys.Test.csproj | 2 +- .../Bannerlord.ButterLib.Implementation.Tests.csproj | 2 +- .../Bannerlord.ButterLib.ObjectSystem.Test.csproj | 2 +- .../Bannerlord.ButterLib.Tests.csproj | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Bannerlord.ButterLib.Implementation/Bannerlord.ButterLib.Implementation.csproj b/src/Bannerlord.ButterLib.Implementation/Bannerlord.ButterLib.Implementation.csproj index c1ebb2a6..6df46153 100644 --- a/src/Bannerlord.ButterLib.Implementation/Bannerlord.ButterLib.Implementation.csproj +++ b/src/Bannerlord.ButterLib.Implementation/Bannerlord.ButterLib.Implementation.csproj @@ -35,7 +35,7 @@ - + diff --git a/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj b/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj index 505c4d49..ad01becc 100644 --- a/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj +++ b/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj @@ -35,7 +35,7 @@ - + diff --git a/tests/Bannerlord.ButterLib.HotKeys.Test/Bannerlord.ButterLib.HotKeys.Test.csproj b/tests/Bannerlord.ButterLib.HotKeys.Test/Bannerlord.ButterLib.HotKeys.Test.csproj index 528ae2aa..e9f37eba 100644 --- a/tests/Bannerlord.ButterLib.HotKeys.Test/Bannerlord.ButterLib.HotKeys.Test.csproj +++ b/tests/Bannerlord.ButterLib.HotKeys.Test/Bannerlord.ButterLib.HotKeys.Test.csproj @@ -21,7 +21,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj b/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj index 35103dce..837d63b7 100644 --- a/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj +++ b/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj @@ -19,7 +19,7 @@ - + diff --git a/tests/Bannerlord.ButterLib.ObjectSystem.Test/Bannerlord.ButterLib.ObjectSystem.Test.csproj b/tests/Bannerlord.ButterLib.ObjectSystem.Test/Bannerlord.ButterLib.ObjectSystem.Test.csproj index a80a97d1..fc7d1903 100644 --- a/tests/Bannerlord.ButterLib.ObjectSystem.Test/Bannerlord.ButterLib.ObjectSystem.Test.csproj +++ b/tests/Bannerlord.ButterLib.ObjectSystem.Test/Bannerlord.ButterLib.ObjectSystem.Test.csproj @@ -21,7 +21,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj b/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj index 249faea6..82cdb808 100644 --- a/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj +++ b/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj @@ -19,7 +19,7 @@ - + From 3d7c918b7f736d6912f97a6615fbff8bae0f47a2 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Sat, 8 Apr 2023 20:18:25 +0300 Subject: [PATCH 02/15] netstandard2.0 reference assemblies --- .../Bannerlord.ButterLib.csproj | 24 ++++++++++++++++++- .../ButterLibSubModule.cs | 10 ++------ .../ExceptionHandler/HtmlBuilder.cs | 5 ++-- .../ExceptionHandler/ProcessExtensions.cs | 5 +++- .../WinForms/HtmlCrashReportForm.Designer.cs | 6 +++-- .../WinForms/HtmlCrashReportForm.cs | 6 +++-- 6 files changed, 40 insertions(+), 16 deletions(-) diff --git a/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj b/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj index ad01becc..bbec774f 100644 --- a/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj +++ b/src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj @@ -2,11 +2,12 @@ - net472;netcoreapp3.1 + net472;netcoreapp3.1;netstandard2.0 11.0 enable x64 true + true $(BANNERLORD_BUTR_UPLOAD_URL) $(DefineConstants);BANNERLORDBUTRSHARED_BUTTERLIB @@ -81,4 +82,25 @@ + + + + false + + true + + $(TargetsForTfmSpecificContentInPackage);AddRefAssemblyToPackage + + + + + + ref/netstandard2.0 + + + ref/netstandard2.0 + + + + diff --git a/src/Bannerlord.ButterLib/ButterLibSubModule.cs b/src/Bannerlord.ButterLib/ButterLibSubModule.cs index 1cfa5933..3d03d283 100644 --- a/src/Bannerlord.ButterLib/ButterLibSubModule.cs +++ b/src/Bannerlord.ButterLib/ButterLibSubModule.cs @@ -18,7 +18,6 @@ using System.IO; using System.Linq; using System.Text; -using System.Windows.Forms; using TaleWorlds.CampaignSystem; using TaleWorlds.Core; @@ -26,11 +25,6 @@ using TaleWorlds.Localization; using TaleWorlds.MountAndBlade; -using DialogResult = System.Windows.Forms.DialogResult; -using MessageBoxButtons = System.Windows.Forms.MessageBoxButtons; -using MessageBoxDefaultButton = System.Windows.Forms.MessageBoxDefaultButton; -using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon; -using MessageBoxOptions = System.Windows.Forms.MessageBoxOptions; using Path = System.IO.Path; namespace Bannerlord.ButterLib @@ -198,9 +192,9 @@ private static void ValidateLoadOrder() sb.AppendLine(report); sb.AppendLine(); sb.AppendLine(new TextObject(SMessageContinue).ToString()); - switch (MessageBox.Show(sb.ToString(), new TextObject(SWarningTitle).ToString(), MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, (MessageBoxOptions) 0x40000)) + switch (System.Windows.Forms.MessageBox.Show(sb.ToString(), new TextObject(SWarningTitle).ToString(), System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning, System.Windows.Forms.MessageBoxDefaultButton.Button1, (System.Windows.Forms.MessageBoxOptions) 0x40000)) { - case DialogResult.Yes: + case System.Windows.Forms.DialogResult.Yes: Environment.Exit(1); break; } diff --git a/src/Bannerlord.ButterLib/ExceptionHandler/HtmlBuilder.cs b/src/Bannerlord.ButterLib/ExceptionHandler/HtmlBuilder.cs index f02e163a..1a511e19 100644 --- a/src/Bannerlord.ButterLib/ExceptionHandler/HtmlBuilder.cs +++ b/src/Bannerlord.ButterLib/ExceptionHandler/HtmlBuilder.cs @@ -1,7 +1,6 @@ using Bannerlord.BUTR.Shared.Extensions; using Bannerlord.BUTR.Shared.Helpers; using Bannerlord.ButterLib.Common.Extensions; -using Bannerlord.ButterLib.ExceptionHandler.WinForms; using Bannerlord.ButterLib.Logger; using Bannerlord.ModuleManager; @@ -40,8 +39,10 @@ internal static class HtmlBuilder public static void BuildAndShow(CrashReport crashReport) { - using var form = new HtmlCrashReportForm(crashReport); +#if !NETSTANDARD2_0_OR_GREATER + using var form = new Bannerlord.ButterLib.ExceptionHandler.WinForms.HtmlCrashReportForm(crashReport); form.ShowDialog(); +#endif } public static string Build(CrashReport crashReport) diff --git a/src/Bannerlord.ButterLib/ExceptionHandler/ProcessExtensions.cs b/src/Bannerlord.ButterLib/ExceptionHandler/ProcessExtensions.cs index 19f1df40..87001c57 100644 --- a/src/Bannerlord.ButterLib/ExceptionHandler/ProcessExtensions.cs +++ b/src/Bannerlord.ButterLib/ExceptionHandler/ProcessExtensions.cs @@ -77,7 +77,10 @@ private struct PROCESSENTRY32 public string szExeFile; }; - [SuppressUnmanagedCodeSecurity, HostProtection(SecurityAction.LinkDemand, MayLeakOnAbort = true)] +#if !NETSTANDARD2_0_OR_GREATER + [HostProtection(SecurityAction.LinkDemand, MayLeakOnAbort = true)] +#endif + [SuppressUnmanagedCodeSecurity] private sealed class SafeSnapshotHandle : SafeHandleMinusOneIsInvalid { internal SafeSnapshotHandle() : base(true) { } diff --git a/src/Bannerlord.ButterLib/ExceptionHandler/WinForms/HtmlCrashReportForm.Designer.cs b/src/Bannerlord.ButterLib/ExceptionHandler/WinForms/HtmlCrashReportForm.Designer.cs index 2288326a..5ab288ac 100644 --- a/src/Bannerlord.ButterLib/ExceptionHandler/WinForms/HtmlCrashReportForm.Designer.cs +++ b/src/Bannerlord.ButterLib/ExceptionHandler/WinForms/HtmlCrashReportForm.Designer.cs @@ -1,4 +1,5 @@ -namespace Bannerlord.ButterLib.ExceptionHandler.WinForms +#if !NETSTANDARD2_0_OR_GREATER +namespace Bannerlord.ButterLib.ExceptionHandler.WinForms { partial class HtmlCrashReportForm { @@ -61,4 +62,5 @@ private void InitializeComponent() private System.Windows.Forms.WebBrowser HtmlRender; } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/src/Bannerlord.ButterLib/ExceptionHandler/WinForms/HtmlCrashReportForm.cs b/src/Bannerlord.ButterLib/ExceptionHandler/WinForms/HtmlCrashReportForm.cs index 3bdf665d..a6458664 100644 --- a/src/Bannerlord.ButterLib/ExceptionHandler/WinForms/HtmlCrashReportForm.cs +++ b/src/Bannerlord.ButterLib/ExceptionHandler/WinForms/HtmlCrashReportForm.cs @@ -1,4 +1,5 @@ -using Bannerlord.BUTR.Shared.Helpers; +#if !NETSTANDARD2_0_OR_GREATER +using Bannerlord.BUTR.Shared.Helpers; using Bannerlord.ButterLib.Common.Extensions; using Bannerlord.ButterLib.CrashUploader; using Bannerlord.ButterLib.Extensions; @@ -330,4 +331,5 @@ private static async Task SetClipboardTextAsync(string text) await completionSource.Task; } } -} \ No newline at end of file +} +#endif \ No newline at end of file From da013192ed2783eeb1e5be00f84cd736e4e09be9 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Sun, 9 Apr 2023 20:00:00 +0300 Subject: [PATCH 03/15] Update --- build/common.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/common.props b/build/common.props index b0664c56..f0522a3a 100644 --- a/build/common.props +++ b/build/common.props @@ -14,7 +14,7 @@ 2.0.0 1.0.1.92 - 3.0.0.135 + 3.0.0.136 5.0.198 From 8e2e1e51184a49202f9381bbf851d57fcf6f5404 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Thu, 27 Apr 2023 17:49:58 +0300 Subject: [PATCH 04/15] Switching to the new docfx --- .github/workflows/docfx.yml | 19 +++++------- docs/docfx.json | 36 +++++++--------------- docs/langwordMapping.yml | 61 ------------------------------------- docs/toc.yml | 5 --- resources/BUTR48.svg | 21 +++++++++++++ 5 files changed, 39 insertions(+), 103 deletions(-) delete mode 100644 docs/langwordMapping.yml create mode 100644 resources/BUTR48.svg diff --git a/.github/workflows/docfx.yml b/.github/workflows/docfx.yml index ee160a51..2794c8b9 100644 --- a/.github/workflows/docfx.yml +++ b/.github/workflows/docfx.yml @@ -22,30 +22,25 @@ env: jobs: docfx: - name: DocFX documentation + name: DocFX Documentation runs-on: ubuntu-latest steps: - name: DocFX Setup - uses: butr/actions-docfx-setup@v3.0 + uses: butr/actions-docfx-setup@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} - name: Build Bannerlord.ButterLib - run: >- - dotnet build src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj; + run: dotnet build src/Bannerlord.ButterLib/Bannerlord.ButterLib.csproj; shell: pwsh - name: Run DocFX run: >- Copy-Item "README.md" -Destination "docs/index.md"; - if ($${{runner.os == 'Windows'}}) { - docfx.console/tools/docfx.exe metadata docs/docfx.json; - docfx.console/tools/docfx.exe build docs/docfx.json; - } - else { - mono docfx.console/tools/docfx.exe metadata docs/docfx.json; - mono docfx.console/tools/docfx.exe build docs/docfx.json; - } + New-Item -Type dir "docs/images"; + Copy-Item "resources/BUTR48.svg" -Destination "docs/images/BUTR48.svg"; + docfx metadata docs/docfx.json; + docfx build docs/docfx.json; shell: pwsh - name: Deploy DocFX diff --git a/docs/docfx.json b/docs/docfx.json index f7a5e008..16f5b1c6 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -20,46 +20,32 @@ ], "content": [ { - "files": [ - "api/**.yml", - "api/index.md" - ] - }, - { - "files": [ - "articles/**.md", - "articles/**/toc.yml", - "toc.yml", - "*.md" - ] + "files": [ "**/**.{md,yml}" ], + "exclude": [ "_site/**", "obj/**" ] } ], "resource": [ { - "files": [ - "langwordMapping.yml", - "images/**" - ] - }, - { - "src": "../", - "files": [ "resources/**" ] + "files": [ "**/images/**", "codesnippet/**" ], + "exclude": [ "_site/**", "obj/**" ] } ], - "overwrite": [ ], "dest": "_site", "globalMetadata": { "_enableSearch": "true", + "_appLogoPath": "images/BUTR48.svg", + "_appName": "ButterLib", "_appTitle": "ButterLib Documentation", - "_appFooter": "© 2020 BUTR", + "_appFooter": "© 2020-2023 Bannerlord's Unofficial Tools & Resources" }, "globalMetadataFiles": [], "fileMetadataFiles": [], "template": [ "default", - "_template/dark-theme" + "modern" ], - "postProcessors": ["ExtractSearchIndex"], - "markdownEngineName": "markdig" + "postProcessors": [ + "ExtractSearchIndex" + ] } } diff --git a/docs/langwordMapping.yml b/docs/langwordMapping.yml deleted file mode 100644 index 9ddd00ca..00000000 --- a/docs/langwordMapping.yml +++ /dev/null @@ -1,61 +0,0 @@ -references: -- uid: langword_csharp_null - name.csharp: "null" - name.vb: "Nothing" -- uid: langword_vb_Nothing - name.csharp: "null" - name.vb: "Nothing" -- uid: langword_csharp_static - name.csharp: static - name.vb: Shared -- uid: langword_vb_Shared - name.csharp: static - name.vb: Shared -- uid: langword_csharp_virtual - name.csharp: virtual - name.vb: Overridable -- uid: langword_vb_Overridable - name.csharp: virtual - name.vb: Overridable -- uid: langword_csharp_true - name.csharp: "true" - name.vb: "True" -- uid: langword_vb_True - name.csharp: "true" - name.vb: "True" -- uid: langword_csharp_false - name.csharp: "false" - name.vb: "False" -- uid: langword_vb_False - name.csharp: "false" - name.vb: "False" -- uid: langword_csharp_abstract - name.csharp: abstract - name.vb: MustInherit -- uid: langword_vb_MustInherit - name.csharp: abstract - name.vb: MustInherit -- uid: langword_csharp_sealed - name.csharp: sealed - name.vb: NotInheritable -- uid: langword_vb_NotInheritable - name.csharp: sealed - name.vb: NotInheritable -- uid: langword_csharp_async - name.csharp: async - name.vb: Async -- uid: langword_vb_Async - name.csharp: async - name.vb: Async -- uid: langword_csharp_await - name.csharp: await - name.vb: Await -- uid: langword_vb_Await - name.csharp: await - name.vb: Await -- uid: langword_csharp_async/await - name.csharp: async/await - name.vb: Async/Await -- uid: langword_vb_Async/Await - name.csharp: async/await - name.vb: Async/Await \ No newline at end of file diff --git a/docs/toc.yml b/docs/toc.yml index 5e760306..84c75e6a 100644 --- a/docs/toc.yml +++ b/docs/toc.yml @@ -1,15 +1,10 @@ -- name: ButterLib - href: index.md - - name: Articles href: articles/ - homepage: articles/index.md - name: API Documentation href: api/ - name: Bannerlord Documentations - dropdown: true items: - name: Official Documentation href: http://docs.modding.bannerlord.com/ diff --git a/resources/BUTR48.svg b/resources/BUTR48.svg new file mode 100644 index 00000000..0ea7e850 --- /dev/null +++ b/resources/BUTR48.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + From 3e1d2569cd7e1f94e2d04a3f906340526f2acbe2 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Thu, 27 Apr 2023 17:53:15 +0300 Subject: [PATCH 05/15] Test fix --- .../HarmonyDisposable.cs | 2 +- tests/Bannerlord.ButterLib.Tests/HarmonyDisposable.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Bannerlord.ButterLib.Implementation.Tests/HarmonyDisposable.cs b/tests/Bannerlord.ButterLib.Implementation.Tests/HarmonyDisposable.cs index 38ca7ed7..2afb2b5f 100644 --- a/tests/Bannerlord.ButterLib.Implementation.Tests/HarmonyDisposable.cs +++ b/tests/Bannerlord.ButterLib.Implementation.Tests/HarmonyDisposable.cs @@ -10,7 +10,7 @@ public HarmonyDisposable(string id) : base(id) { } public void Dispose() { - UnpatchSelf(); + UnpatchAll(Id); } } } \ No newline at end of file diff --git a/tests/Bannerlord.ButterLib.Tests/HarmonyDisposable.cs b/tests/Bannerlord.ButterLib.Tests/HarmonyDisposable.cs index f7d1e89d..e3ed8be5 100644 --- a/tests/Bannerlord.ButterLib.Tests/HarmonyDisposable.cs +++ b/tests/Bannerlord.ButterLib.Tests/HarmonyDisposable.cs @@ -10,7 +10,7 @@ public HarmonyDisposable(string id) : base(id) { } public void Dispose() { - UnpatchSelf(); + UnpatchAll(Id); } } } \ No newline at end of file From 27e4a790f5c60c68ff21fde43036e89e8078c349 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Fri, 28 Apr 2023 09:11:24 +0300 Subject: [PATCH 06/15] Fixed docs --- docs/articles/AssemblyVerifier/toc.yml | 3 +++ docs/articles/CampaignIdentifier/toc.yml | 3 +++ docs/articles/Common/Extensions/toc.yml | 3 +++ docs/articles/Common/Helpers/toc.yml | 3 +++ docs/articles/Common/toc.yml | 4 +-- docs/articles/DelayedSubModule/toc.yml | 3 +++ docs/articles/Development/toc.yml | 3 +++ docs/articles/DistanceMatrix/toc.yml | 3 +++ docs/articles/HotKeys/toc.yml | 3 +++ docs/articles/MBSubModuleBaseExtended/toc.yml | 3 +++ docs/articles/Optional/toc.yml | 2 -- docs/articles/SaveSystem/toc.yml | 3 +++ docs/articles/SubModuleWrappers/toc.yml | 3 +++ docs/articles/toc.yml | 27 +++++++------------ 14 files changed, 44 insertions(+), 22 deletions(-) create mode 100644 docs/articles/AssemblyVerifier/toc.yml create mode 100644 docs/articles/CampaignIdentifier/toc.yml create mode 100644 docs/articles/Common/Extensions/toc.yml create mode 100644 docs/articles/Common/Helpers/toc.yml create mode 100644 docs/articles/DelayedSubModule/toc.yml create mode 100644 docs/articles/Development/toc.yml create mode 100644 docs/articles/DistanceMatrix/toc.yml create mode 100644 docs/articles/HotKeys/toc.yml create mode 100644 docs/articles/MBSubModuleBaseExtended/toc.yml create mode 100644 docs/articles/SaveSystem/toc.yml create mode 100644 docs/articles/SubModuleWrappers/toc.yml diff --git a/docs/articles/AssemblyVerifier/toc.yml b/docs/articles/AssemblyVerifier/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/AssemblyVerifier/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/CampaignIdentifier/toc.yml b/docs/articles/CampaignIdentifier/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/CampaignIdentifier/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/Common/Extensions/toc.yml b/docs/articles/Common/Extensions/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/Common/Extensions/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/Common/Helpers/toc.yml b/docs/articles/Common/Helpers/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/Common/Helpers/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/Common/toc.yml b/docs/articles/Common/toc.yml index cb0e81d9..802b2ff8 100644 --- a/docs/articles/Common/toc.yml +++ b/docs/articles/Common/toc.yml @@ -1,7 +1,7 @@ - name: Extensions - href: Extensions/ + href: Extensions/toc.yml homepage: Extensions/Overview.md - name: Helpers - href: Helpers/ + href: Helpers/toc.yml homepage: Helpers/Overview.md diff --git a/docs/articles/DelayedSubModule/toc.yml b/docs/articles/DelayedSubModule/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/DelayedSubModule/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/Development/toc.yml b/docs/articles/Development/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/Development/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/DistanceMatrix/toc.yml b/docs/articles/DistanceMatrix/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/DistanceMatrix/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/HotKeys/toc.yml b/docs/articles/HotKeys/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/HotKeys/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/MBSubModuleBaseExtended/toc.yml b/docs/articles/MBSubModuleBaseExtended/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/MBSubModuleBaseExtended/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/Optional/toc.yml b/docs/articles/Optional/toc.yml index b845b203..aa07fb0b 100644 --- a/docs/articles/Optional/toc.yml +++ b/docs/articles/Optional/toc.yml @@ -1,6 +1,4 @@ - name: Dependency Injection href: DependencyInjection/toc.yml - homepage: DependencyInjection/Overview.md - name: Logging href: Logging/toc.yml - homepage: Logging/Overview.md diff --git a/docs/articles/SaveSystem/toc.yml b/docs/articles/SaveSystem/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/SaveSystem/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/SubModuleWrappers/toc.yml b/docs/articles/SubModuleWrappers/toc.yml new file mode 100644 index 00000000..2f9cbc05 --- /dev/null +++ b/docs/articles/SubModuleWrappers/toc.yml @@ -0,0 +1,3 @@ +- name: Overview + href: Overview.md + diff --git a/docs/articles/toc.yml b/docs/articles/toc.yml index cafd0313..a09ac786 100644 --- a/docs/articles/toc.yml +++ b/docs/articles/toc.yml @@ -1,41 +1,32 @@ - name: Development - href: Development/ - homepage: Development/Overview.md + href: Development/toc.yml - name: AssemblyVerifier - href: AssemblyVerifier/ - homepage: AssemblyVerifier/Overview.md + href: AssemblyVerifier/toc.yml - name: Common href: Common/toc.yml - name: DelayedSubModule - href: DelayedSubModule/ - homepage: DelayedSubModule/Overview.md + href: DelayedSubModule/toc.yml - name: CampaignIdentifier - href: CampaignIdentifier/ - homepage: CampaignIdentifier/Overview.md + href: CampaignIdentifier/toc.yml - name: DistanceMatrix - href: DistanceMatrix/ - homepage: DistanceMatrix/Overview.md + href: DistanceMatrix/toc.yml - name: HotKeys - href: HotKeys/ - homepage: HotKeys/Overview.md + href: HotKeys/toc.yml - name: MBSubModuleBaseExtended - href: MBSubModuleBaseExtended/ - homepage: MBSubModuleBaseExtended/Overview.md + href: MBSubModuleBaseExtended/toc.yml - name: Optional href: Optional/toc.yml - name: SaveSystem - href: SaveSystem/ - homepage: SaveSystem/Overview.md + href: SaveSystem/toc.yml - name: SubModuleWrappers - href: SubModuleWrappers/ - homepage: SubModuleWrappers/Overview.md + href: SubModuleWrappers/toc.yml From a3b3a949a9f88da1e0d11c4adc6ca966cd8a9550 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Fri, 28 Apr 2023 09:20:52 +0300 Subject: [PATCH 07/15] Doc fixes --- docs/articles/CampaignIdentifier/Overview.md | 4 ++++ docs/articles/Common/Extensions/Overview.md | 7 +++---- docs/articles/Common/Helpers/Overview.md | 17 +---------------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/docs/articles/CampaignIdentifier/Overview.md b/docs/articles/CampaignIdentifier/Overview.md index aa5519ed..08fb6c36 100644 --- a/docs/articles/CampaignIdentifier/Overview.md +++ b/docs/articles/CampaignIdentifier/Overview.md @@ -1,3 +1,7 @@ +> [!IMPORTANT] +> This SubSystem is obsolete! +> + [``CampaignIdentifier``](xref:Bannerlord.ButterLib.CampaignIdentifier) associates unique string ID with every campaign basing on the initial character. ```csharp // Get current campaign ID diff --git a/docs/articles/Common/Extensions/Overview.md b/docs/articles/Common/Extensions/Overview.md index 7cbcb44f..bab9a18f 100644 --- a/docs/articles/Common/Extensions/Overview.md +++ b/docs/articles/Common/Extensions/Overview.md @@ -7,11 +7,10 @@ ### [``DependencyInjectionExtensions``](xref:Bannerlord.ButterLib.Common.Extensions.DependencyInjectionExtensions) -### [``DictionaryExtensions``](xref:Bannerlord.ButterLib.Common.Extensions.DictionaryExtensions) - - ### [``ICampaignExtensions``](xref:Bannerlord.ButterLib.Common.Extensions.ICampaignExtensions) +### [``IInputContextExtensions``](xref:Bannerlord.ButterLib.Common.Extensions.IInputContextExtensions) + + ### [``MbEventExtensions``](xref:Bannerlord.ButterLib.Common.Extensions.MbEventExtensions) - diff --git a/docs/articles/Common/Helpers/Overview.md b/docs/articles/Common/Helpers/Overview.md index b054600c..61d3e8ab 100644 --- a/docs/articles/Common/Helpers/Overview.md +++ b/docs/articles/Common/Helpers/Overview.md @@ -1,20 +1,5 @@ -### [``AccessTools2``](xref:Bannerlord.ButterLib.Common.Helpers.AccessTools2) -Gives the ability to get a ``Delegate`` from a method. - -### [``SymbolExtensions2``](xref:Bannerlord.ButterLib.Common.Helpers.SymbolExtensions2) - - -### [``AlphanumComparatorFast``](xref:Bannerlord.ButterLib.Common.Helpers.AlphanumComparatorFast) -Alphanumeric sort. This sorting algorithm logically handles numbers in strings. It makes sense to humans. - -### [``ApplicationVersionUtils``](xref:Bannerlord.ButterLib.Common.Helpers.ApplicationVersionUtils) +### [``ApplicationVersionComparer``](xref:Bannerlord.ButterLib.Common.Helpers.ApplicationVersionComparer) ### [``ElegantPairHelper``](xref:Bannerlord.ButterLib.Common.Helpers.ElegantPairHelper) - -### [``LocalizationHelper``](xref:Bannerlord.ButterLib.Common.Helpers.LocalizationHelper) -A number of useful methods to work with [``TextObjects``](xref:TaleWorlds.Localization.TextObject) for easier and more efficient localization. - -### [``ModuleInfoHelper``](xref:Bannerlord.ButterLib.Common.Helpers.ModuleInfoHelper) - From c4418f1eae74d8dac50027a948d21128125d8eb1 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Fri, 28 Apr 2023 10:12:51 +0300 Subject: [PATCH 08/15] Create CNAME --- docs/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 00000000..865f270f --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +butterlib.butr.link From 75e61ff3eb201610b2a8acfbf4779e02d84a1867 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Fri, 28 Apr 2023 10:13:00 +0300 Subject: [PATCH 09/15] Update docfx.json --- docs/docfx.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docfx.json b/docs/docfx.json index 16f5b1c6..54409b2d 100644 --- a/docs/docfx.json +++ b/docs/docfx.json @@ -26,7 +26,7 @@ ], "resource": [ { - "files": [ "**/images/**", "codesnippet/**" ], + "files": [ "**/images/**", "codesnippet/**", "CNAME" ], "exclude": [ "_site/**", "obj/**" ] } ], From 0ed128b37f81a721999d0f432981e77ea6d2c694 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 May 2023 04:59:43 +0000 Subject: [PATCH 10/15] Bump codecov/codecov-action from 3.1.1 to 3.1.4 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.1 to 3.1.4. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v3.1.1...v3.1.4) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/test-full.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-full.yml b/.github/workflows/test-full.yml index 451a500c..7cf57c16 100644 --- a/.github/workflows/test-full.yml +++ b/.github/workflows/test-full.yml @@ -86,7 +86,7 @@ jobs: path: coveragereport - name: Upload ReportGenerator to CodeCov - uses: codecov/codecov-action@v3.1.1 + uses: codecov/codecov-action@v3.1.4 with: token: ${{secrets.CODECOV_TOKEN}} file: coveragereport/Cobertura.xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3007750..5e2ab122 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -92,7 +92,7 @@ jobs: path: coveragereport - name: Upload ReportGenerator to CodeCov - uses: codecov/codecov-action@v3.1.1 + uses: codecov/codecov-action@v3.1.4 with: token: ${{secrets.CODECOV_TOKEN}} file: coveragereport/Cobertura.xml From f5118625de7091ec588ef9c16ab5b3ed9a5c28cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Jun 2023 05:01:01 +0000 Subject: [PATCH 11/15] Bump danielpalme/ReportGenerator-GitHub-Action from 5.1.19 to 5.1.22 Bumps [danielpalme/ReportGenerator-GitHub-Action](https://github.com/danielpalme/ReportGenerator-GitHub-Action) from 5.1.19 to 5.1.22. - [Release notes](https://github.com/danielpalme/ReportGenerator-GitHub-Action/releases) - [Commits](https://github.com/danielpalme/ReportGenerator-GitHub-Action/compare/5.1.19...5.1.22) --- updated-dependencies: - dependency-name: danielpalme/ReportGenerator-GitHub-Action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/test-full.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-full.yml b/.github/workflows/test-full.yml index 451a500c..dce94376 100644 --- a/.github/workflows/test-full.yml +++ b/.github/workflows/test-full.yml @@ -71,7 +71,7 @@ jobs: shell: pwsh - name: ReportGenerator - uses: danielpalme/ReportGenerator-GitHub-Action@5.1.19 + uses: danielpalme/ReportGenerator-GitHub-Action@5.1.22 with: reports: '*.xml' targetdir: 'coveragereport' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3007750..e189d718 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -77,7 +77,7 @@ jobs: shell: pwsh - name: ReportGenerator - uses: danielpalme/ReportGenerator-GitHub-Action@5.1.19 + uses: danielpalme/ReportGenerator-GitHub-Action@5.1.22 with: reports: 'coverage_butterlib_stable_debug.xml;coverage_butterlib_stable_release.xml;coverage_butterlib_impl_stable_debug.xml;coverage_butterlib_impl_stable_release.xml;coverage_butterlib_impl_beta_debug.xml;coverage_butterlib_impl_beta_release.xml;' targetdir: 'coveragereport' From ec2ac376aed611b701b6b44a87bd6efb99519f66 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Fri, 23 Jun 2023 15:46:48 +0300 Subject: [PATCH 12/15] Update test-full.yml --- .github/workflows/test-full.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-full.yml b/.github/workflows/test-full.yml index 451a500c..a9651641 100644 --- a/.github/workflows/test-full.yml +++ b/.github/workflows/test-full.yml @@ -37,7 +37,7 @@ jobs: runs-on: windows-latest steps: - name: Tests Setup - uses: butr/actions-tests-setup@v1.5.6 + uses: butr/actions-tests-setup@v1 with: github-token: ${{secrets.GITHUB_TOKEN}} From f181a3088fbfa1878c47184e69dc997ee6094d9a Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Fri, 23 Jun 2023 15:46:54 +0300 Subject: [PATCH 13/15] Update test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e3007750..a5423666 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,7 @@ jobs: runs-on: windows-latest steps: - name: Tests Setup - uses: butr/actions-tests-setup@v1.5.6 + uses: butr/actions-tests-setup@v1 with: github-token: ${{secrets.GITHUB_TOKEN}} steam-login: ${{secrets.STEAM_LOGIN}} From 22e3e508953dd3fd63f7da1a1d4ca63b6139a66c Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Fri, 23 Jun 2023 23:54:41 +0300 Subject: [PATCH 14/15] Added support for v1.2.0 --- build/common.props | 6 +++--- changelog.txt | 4 ++++ .../HotKeys/HotKeyManagerImplementation.cs | 10 +++++++--- .../ObjectSystem/MBObjectExtensionDataStore.cs | 6 ++++++ supported-game-versions.txt | 4 ++++ .../Bannerlord.ButterLib.Implementation.Tests.csproj | 2 +- .../Bannerlord.ButterLib.Tests.csproj | 2 +- 7 files changed, 26 insertions(+), 8 deletions(-) diff --git a/build/common.props b/build/common.props index f0522a3a..1fcbb887 100644 --- a/build/common.props +++ b/build/common.props @@ -4,7 +4,7 @@ - 2.8.0 + 2.8.1 2.2.2 3.2.0.77 @@ -13,9 +13,9 @@ 2.0.0 - 1.0.1.92 + 1.1.0.102 3.0.0.136 - 5.0.198 + 5.0.209 diff --git a/changelog.txt b/changelog.txt index 25875852..b8b78aa7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,8 @@ --------------------------------------------------------------------------------------------------- +Version: 2.8.1 +Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1,v1.1.2,v1.1.3,v1.1.4,v1.1.5,v1.2.0 +* Added support for v1.2.0 +--------------------------------------------------------------------------------------------------- Version: 2.8.0 Game Versions: v1.0.0,v1.0.1,v1.0.2,v1.0.3,v1.1.0,v1.1.1,v1.1.2 * Switched back to Lib.Harmony diff --git a/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeyManagerImplementation.cs b/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeyManagerImplementation.cs index cd50ae26..3fe444ed 100644 --- a/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeyManagerImplementation.cs +++ b/src/Bannerlord.ButterLib.Implementation/HotKeys/HotKeyManagerImplementation.cs @@ -10,8 +10,6 @@ using System.Collections.Generic; using System.Linq; -using TaleWorlds.InputSystem; - using HotKeyManager = Bannerlord.ButterLib.HotKeys.HotKeyManager; using TWHotKeyManager = TaleWorlds.InputSystem.HotKeyManager; @@ -53,7 +51,13 @@ public override IReadOnlyList Build() var hotKeyCategoryContainer = new HotKeyCategoryContainer(_modName, _categoryName, _instanceHotKeys); - TWHotKeyManager.RegisterInitialContexts(new List { hotKeyCategoryContainer }, true); +#if v100 || v101 || v102 || v103 || v110 || v111 || v112 || v113 || v114 || v115 + TWHotKeyManager.RegisterInitialContexts(new[] { hotKeyCategoryContainer }, true); +#elif v120 + TWHotKeyManager.RegisterInitialContexts(TWHotKeyManager.GetAllCategories().ToList().Concat(new[] { hotKeyCategoryContainer }), true); +#else +#error DEFINE +#endif GlobalContainerStorage.Add(hotKeyCategoryContainer); var keys = hotKeyCategoryContainer.RegisteredGameKeys; diff --git a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs index a62437c0..30b0b11c 100755 --- a/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs +++ b/src/Bannerlord.ButterLib.Implementation/ObjectSystem/MBObjectExtensionDataStore.cs @@ -122,7 +122,13 @@ private sealed class DataKey : IEquatable public override string ToString() => $"{ObjectId}::{Key}"; } +#if v100 || v101 || v102 || v103 || v110 || v111 || v112 || v113 || v114 || v115 private sealed class SavedTypeDefiner : SaveableCampaignBehaviorTypeDefiner +#elif v120 + private sealed class SavedTypeDefiner : SaveableTypeDefiner +#else +#error DEFINE +#endif { public SavedTypeDefiner() : base(222_444_700) { } protected override void DefineClassTypes() => AddClassDefinition(typeof(DataKey), 1); diff --git a/supported-game-versions.txt b/supported-game-versions.txt index 447a919a..d4d7322a 100644 --- a/supported-game-versions.txt +++ b/supported-game-versions.txt @@ -1,3 +1,7 @@ +v1.2.0 +v1.1.5 +v1.1.4 +v1.1.3 v1.1.2 v1.1.1 v1.1.0 diff --git a/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj b/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj index 837d63b7..3b72ace8 100644 --- a/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj +++ b/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj @@ -17,7 +17,7 @@ - + diff --git a/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj b/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj index 82cdb808..6aabbe49 100644 --- a/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj +++ b/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj @@ -17,7 +17,7 @@ - + From e6c9761a12c4e4e3bf9a6dedd0c5a1dc6254fea9 Mon Sep 17 00:00:00 2001 From: Vitalii Mikhailov Date: Sat, 24 Jun 2023 00:00:52 +0300 Subject: [PATCH 15/15] Test fix --- .../Bannerlord.ButterLib.Implementation.Tests.csproj | 2 +- .../Bannerlord.ButterLib.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj b/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj index 3b72ace8..f6cf68fb 100644 --- a/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj +++ b/tests/Bannerlord.ButterLib.Implementation.Tests/Bannerlord.ButterLib.Implementation.Tests.csproj @@ -19,7 +19,7 @@ - + diff --git a/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj b/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj index 6aabbe49..5af69de1 100644 --- a/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj +++ b/tests/Bannerlord.ButterLib.Tests/Bannerlord.ButterLib.Tests.csproj @@ -19,7 +19,7 @@ - +