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/Patches/Internals/PostAuthentication.cs

34 lines
1.1 KiB
C#

using System.Reflection;
using HarmonyLib;
using undead_universal_patch_il2cpp.Core;
using undead_universal_patch_il2cpp.Core.Content.CustomRecNet;
namespace undead_universal_patch_il2cpp.Patches.Internals;
[HarmonyPatch]
public class AuthenticationEventPatch
{
static PatchTypesResult patchResult = Util.PreparePatchTypes(
"RecNet AccessToken event patch",
"RecNet.Login",
"SetAccessToken"
);
static readonly PropertyInfo hasAccessTokenProperty = patchResult.Type?.GetProperty("HasAccessToken");
static bool Prepare() => Util.PostRequireTypes(patchResult, [
hasAccessTokenProperty
]).Success;
static MethodBase TargetMethod() => patchResult.Method;
static void Postfix(ref string accessToken)
{
UniversalPatchPlugin.Log.LogInfo("Intercepted AccessToken");
RecNetInteractions.AccessToken = accessToken;
UniversalPatchPlugin.Log.LogInfo("Running post-authentication actions");
foreach (var action in RecNetInteractions.postAuthenticationActions)
action();
}
}