using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("CentralConfigCrashFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CentralConfigCrashFix")]
[assembly: AssemblyTitle("CentralConfigCrashFix")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace CentralConfigCrashFix;
[BepInPlugin("com.scythlz.centralconfigfix", "CentralConfig Crash Fix", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
Harmony val = new Harmony("com.scythlz.centralconfigfix");
try
{
Type type = AccessTools.TypeByName("CentralConfig.ResetChanger+ResetOnDisconnect");
if (type == null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"ResetOnDisconnect type not found.");
return;
}
MethodInfo methodInfo = AccessTools.Method(type, "Prefix", (Type[])null, (Type[])null);
if (methodInfo == null)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"Prefix method not found.");
return;
}
val.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Plugin), "SkipPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully patched CentralConfig crash on quit.");
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)("Failed to patch CentralConfig: " + ex));
}
}
public static bool SkipPrefix()
{
return false;
}
}