Decompiled source of BastianLoadFix v1.0.0

BastianLoadFix.dll

Decompiled 3 weeks ago
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace BastianLoadFix;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("aeth.BastianLoadFix", "BastianLoadFix", "1.0.0")]
public class BastianLoadFixPlugin : BaseUnityPlugin
{
	internal static ManualLogSource Log;

	private void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		Harmony val = new Harmony("aeth.BastianLoadFix");
		HarmonyMethod val2 = new HarmonyMethod(typeof(BastianLoadFixPlugin).GetMethod("SwallowException", BindingFlags.Static | BindingFlags.NonPublic));
		string[] array = new string[2] { "Bastian.Modules.ItemDisplays:PopulateCustomLightningArm", "Bastian.BastianItemDisplays:SetItemDisplays" };
		string[] array2 = array;
		foreach (string text in array2)
		{
			MethodInfo methodInfo = AccessTools.Method(text, (Type[])null, (Type[])null);
			if (methodInfo == null)
			{
				Log.LogWarning((object)("Could not find " + text + " (Bastian missing or changed?)"));
				continue;
			}
			MethodInfo methodInfo2 = methodInfo;
			HarmonyMethod val3 = val2;
			val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, val3, (HarmonyMethod)null);
			Log.LogInfo((object)("Guarded " + text));
		}
	}

	private static Exception SwallowException(Exception __exception, MethodBase __originalMethod)
	{
		if (__exception != null)
		{
			Log.LogWarning((object)("Suppressed error in " + __originalMethod.DeclaringType.Name + "." + __originalMethod.Name + ": " + __exception.GetType().Name + ": " + __exception.Message));
		}
		return null;
	}
}