Implement module patch abstraction and patch loader (#250)
* Implement patch abstractions and patch loader using an interface * remove patch loader * rename patch class
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
using SPTarkov.Server.Core.Utils;
|
||||
|
||||
namespace SPTarkov.Server.Modding;
|
||||
|
||||
public class HarmonyBootstrapper
|
||||
{
|
||||
public static void LoadAllPatches(List<Assembly> assemblies)
|
||||
{
|
||||
if (!ProgramStatics.MODS())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var hamony = new Harmony("SPT");
|
||||
foreach (var assembly in assemblies)
|
||||
{
|
||||
try
|
||||
{
|
||||
hamony.PatchAll(assembly);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,6 @@ public static class Program
|
||||
|
||||
// validate and sort mods, this will also discard any mods that are invalid
|
||||
var sortedLoadedMods = ValidateMods(mods);
|
||||
// for harmony, we use the original list, as some mods may only be bepinex patches only
|
||||
HarmonyBootstrapper.LoadAllPatches(mods.SelectMany(asm => asm.Assemblies).ToList());
|
||||
|
||||
var diHandler = new DependencyInjectionHandler(builder.Services);
|
||||
// register SPT components
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HarmonyX" Version="2.14.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.1"/>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.1"/>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1"/>
|
||||
|
||||
Reference in New Issue
Block a user