This repository has been archived on 2026-05-30. You can view files and clone it, but cannot push or open issues or pull requests.
Files
undead-universal-patch-il2cpp/BasePatches/SignalRHandshakeFix.cs
zombieb 8d1bac8201 - SignalR handshake fix
- Self-hosted PhotonSocketServer support
- Split photon and hile event patch
- Deprecated amplitude redirect patch
2025-04-13 02:11:08 -04:00

43 lines
1.4 KiB
C#

using System;
using System.Reflection;
using HarmonyLib;
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);
public static MethodBase targetMethod = AccessTools.Method(targetType, TargetMethodName);
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 (targetMethod == 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() => targetMethod;
public static void Prefix(ref string str)
{
if (str.Contains("protocol':"))
{
str = str.Replace("'", "\"");
}
}
}
}