backend refactor yay!!! 1.4.0
This commit is contained in:
42
Patches/TLS.cs
Normal file
42
Patches/TLS.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
using undead_universal_patch_il2cpp.Core;
|
||||
|
||||
namespace undead_universal_patch_il2cpp.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class TLSPatch
|
||||
{
|
||||
static string TargetTypeName = "Org.BouncyCastle.Crypto.Tls.LegacyTlsAuthentication";
|
||||
static string TargetMethodName = "NotifyServerCertificate";
|
||||
static string Description = "Certificate patch";
|
||||
static Type targetType = AccessTools.TypeByName(TargetTypeName);
|
||||
|
||||
static bool Prepare()
|
||||
{
|
||||
if (!GenericConfig.CertificatePatch.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;
|
||||
}
|
||||
|
||||
Plugin.Log.LogInfo($"'{Description}' succeeded validation.");
|
||||
return true;
|
||||
}
|
||||
|
||||
static MethodBase TargetMethod() => AccessTools.Method(targetType, TargetMethodName);
|
||||
|
||||
static bool Prefix()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user