feature: first
All checks were successful
Build / Compute Version (push) Successful in 4s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 2m47s
Build / Build Nuget package (CringePlugins) (push) Successful in 5m31s
Build / Build Nuget package (NuGet) (push) Successful in 6m2s
Build / Build Nuget package (SharedCringe) (push) Successful in 7m25s
Build / Build Launcher (push) Successful in 9m11s
All checks were successful
Build / Compute Version (push) Successful in 4s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 2m47s
Build / Build Nuget package (CringePlugins) (push) Successful in 5m31s
Build / Build Nuget package (NuGet) (push) Successful in 6m2s
Build / Build Nuget package (SharedCringe) (push) Successful in 7m25s
Build / Build Launcher (push) Successful in 9m11s
This commit is contained in:
19
CringeLauncher/Utils/MethodTools.cs
Normal file
19
CringeLauncher/Utils/MethodTools.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace CringeLauncher.Utils;
|
||||
|
||||
public static class MethodTools
|
||||
{
|
||||
public static MethodInfo AsyncMethodBody(MethodInfo method)
|
||||
{
|
||||
var (_, operand) = PatchProcessor.ReadMethodBody(method).First();
|
||||
|
||||
if (operand is not LocalVariableInfo localVar)
|
||||
throw new InvalidOperationException($"Method {method.FullDescription()} does not contain a valid async state machine");
|
||||
|
||||
return AccessTools.Method(localVar.LocalType, "MoveNext") ??
|
||||
throw new InvalidOperationException(
|
||||
$"Async State machine of method {method.FullDescription()} does not contain a valid MoveNext method");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user