INTERNAL REWRITE! server configs
This commit is contained in:
@@ -1,37 +1,25 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
using undead_universal_patch_il2cpp.Core;
|
||||
using undead_universal_patch_il2cpp.Core.Config;
|
||||
|
||||
namespace undead_universal_patch_il2cpp.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class SignalRHandshakeFix
|
||||
{
|
||||
public static string TargetTypeName = "JsonProtocol";
|
||||
public static string TargetMethodName = "WithSeparator";
|
||||
public static string Description = "SignalR Handshake Fix (quotes vs apostrophes)";
|
||||
public static Type targetType = AccessTools.TypeByName(TargetTypeName);
|
||||
static PatchTypesResult patchResult = Util.ConfigPreparePatchTypes(
|
||||
PatchConfig.SignalRHandshakeFix,
|
||||
"SignalR Handshake Fix (quotes vs apostrophes)",
|
||||
"JsonProtocol",
|
||||
"WithSeparator"
|
||||
);
|
||||
|
||||
public static bool Prepare()
|
||||
{
|
||||
if (!GenericConfig.SignalRHandshakeFix.Value) return false;
|
||||
if (targetType == null)
|
||||
{
|
||||
Plugin.Log.LogWarning($"'{Description}' disabled. The type for this patch was not found.");
|
||||
return false;
|
||||
}
|
||||
if (AccessTools.Method(targetType, TargetMethodName) == null)
|
||||
{
|
||||
Plugin.Log.LogWarning($"'{Description}' disabled. The method for this patch was not found.");
|
||||
return false;
|
||||
}
|
||||
static bool Prepare() => patchResult.Success;
|
||||
|
||||
Plugin.Log.LogInfo($"'{Description}' succeeded validation.");
|
||||
return true;
|
||||
}
|
||||
public static MethodBase TargetMethod() => AccessTools.Method(targetType, TargetMethodName);
|
||||
public static void Prefix(ref string str)
|
||||
static MethodBase TargetMethod() => patchResult.Method;
|
||||
|
||||
static void Prefix(ref string str)
|
||||
{
|
||||
if (str.Contains("protocol':"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user