Skip to content

Commit

Permalink
Merge pull request #262 from Aragas/dev
Browse files Browse the repository at this point in the history
v4.7.8 #2
  • Loading branch information
Aragas authored Sep 18, 2022
2 parents 4887578 + 980463b commit 470471e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
8 changes: 4 additions & 4 deletions build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<GameVersion>1.7.2</GameVersion>
<Version>4.7.8</Version>
<HarmonyVersion>2.2.2</HarmonyVersion>
<ButterLibVersion>2.2.1</ButterLibVersion>
<UIExtenderExVersion>2.2.6</UIExtenderExVersion>
<ButterLibVersion>2.2.2</ButterLibVersion>
<UIExtenderExVersion>2.2.7</UIExtenderExVersion>
<BuildResourcesVersion>1.0.1.68</BuildResourcesVersion>
<BUTRSharedVersion>2.0.0.96</BUTRSharedVersion>
<BUTRSharedVersion>2.0.0.98</BUTRSharedVersion>
<BUTRDependencyInjectionVersion>1.0.0.30</BUTRDependencyInjectionVersion>
<BUTRModuleManagerVersion>4.0.123</BUTRModuleManagerVersion>
<HarmonyExtensionsVersion>3.1.0.61</HarmonyExtensionsVersion>
Expand Down Expand Up @@ -82,4 +82,4 @@
</PackageReference>
</ItemGroup>

</Project>
</Project>
22 changes: 6 additions & 16 deletions tests/MCM.Tests/BaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
using NUnit.Framework;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;

using TaleWorlds.Engine;

using v4::Bannerlord.BUTR.Shared.Helpers;
using v4::Bannerlord.ModuleManager;
using v4::MCM;
using v4::MCM.Implementation;

Expand All @@ -32,13 +30,6 @@ private static bool MockedGetConfigsPath(ref string __result)
return false;
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static bool MockedGetLoadedModules(ref IEnumerable<ModuleInfoExtended> __result)
{
__result = new List<ModuleInfoExtended>();
return false;
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static bool MockedGetModulesNames(ref string[] __result)
{
Expand All @@ -51,12 +42,11 @@ private static bool MockedGetModulesNames(ref string[] __result)
[OneTimeSetUp]
public void OneTimeSetUp()
{
_harmony.Patch(AccessTools2.Method(typeof(ButterLibSubModule).Assembly.GetType("Bannerlord.BUTR.Shared.Helpers.FSIOHelper"), "GetConfigPath"),
prefix: new HarmonyMethod(SymbolExtensions2.GetMethodInfo((string x) => MockedGetConfigsPath(ref x))));
_harmony.Patch(SymbolExtensions2.GetMethodInfo(() => FSIOHelper.GetConfigPath()),
prefix: new HarmonyMethod(SymbolExtensions2.GetMethodInfo((string x) => MockedGetConfigsPath(ref x))));
_harmony.Patch(SymbolExtensions2.GetMethodInfo(() => ModuleInfoHelper.GetLoadedModules()),
prefix: new HarmonyMethod(SymbolExtensions2.GetMethodInfo((IEnumerable<ModuleInfoExtended> x) => MockedGetLoadedModules(ref x))));
foreach (var fsioHelper in AccessTools2.AllTypes().Where(x => x.FullName == "Bannerlord.BUTR.Shared.Helpers.FSIOHelper"))
{
_harmony.Patch(AccessTools2.Method(fsioHelper, "GetConfigPath"),
prefix: new HarmonyMethod(SymbolExtensions2.GetMethodInfo((string x) => MockedGetConfigsPath(ref x))));
}
_harmony.Patch(SymbolExtensions2.GetMethodInfo(() => Utilities.GetModulesNames()),
prefix: new HarmonyMethod(SymbolExtensions2.GetMethodInfo((string[] x) => MockedGetModulesNames(ref x))));

Expand Down
4 changes: 2 additions & 2 deletions tests/MCM.Tests/MCM.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0-alpha-net7.4" />

<PackageReference Include="Bannerlord.ButterLib" Version="$(ButterLibVersion)" />
<PackageReference Include="Bannerlord.UIExtenderEx" Version="$(UIExtenderExVersion)" />
Expand Down Expand Up @@ -48,4 +48,4 @@
<ProjectReference Include="..\..\src\MCM\MCM.csproj" Aliases="v4" />
</ItemGroup>

</Project>
</Project>

0 comments on commit 470471e

Please sign in to comment.