INTERNAL REWRITE! server configs

This commit is contained in:
2025-08-12 03:10:25 -04:00
parent 1c51b37a7c
commit 7fc0d6c5b0
23 changed files with 645 additions and 564 deletions

View File

@@ -2,40 +2,27 @@
using HarmonyLib;
using System.Reflection;
using undead_universal_patch_il2cpp.Core;
using undead_universal_patch_il2cpp.Core.Config;
namespace undead_universal_patch_il2cpp.Patches
{
[HarmonyPatch]
public class ImageSignaturePatch
{
public static string TargetTypeName = "Images";
public static string TargetMethodName = "VerifySignature";
public static string Description = "Image signature patch";
public static Type targetType = AccessTools.TypeByName(TargetTypeName);
static PatchTypesResult patchResult = Util.ConfigPreparePatchTypes(
PatchConfig.ImageSignaturePatch,
"Image signature patch",
"RecNet.Images",
"VerifySignature"
);
public static bool Prepare()
static bool Prepare() => patchResult.Success;
static MethodBase TargetMethod() => patchResult.Method;
static bool Prefix(ref bool __result)
{
if (!GenericConfig.ImageSignaturePatch.Value) return false;
if (targetType == null)
{
Plugin.Log.LogWarning($"'{Description}' disabled. The type for this patch was not found.");
return false;
}
if (targetType.GetMethod(TargetMethodName) == null)
{
Plugin.Log.LogWarning($"'{Description}' disabled. The method for this patch was not found.");
return false;
}
Plugin.Log.LogInfo($"'{Description}' succeeded validation.");
return true;
}
public static MethodBase TargetMethod() => targetType.GetMethod(TargetMethodName);
public static bool Prefix(ref bool __result)
{
if (GenericConfig.PatchDebug.Value) Plugin.Log.LogDebug("Verified image signature");
Util.ConditionalDebug("Verified image signature");
__result = true;
return false;
}