Decompiled source of LockPickingLawyer v0.0.1

LockPickingLawyer.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LockPickingLawyer.Patches;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LockPickingLawyer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LockPickingLawyer")]
[assembly: AssemblyTitle("LockPickingLawyer")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace LockPickingLawyer
{
	[BepInPlugin("ainavt.lc.lockpickinglawyer", "LockPickingLawyer", "0.0.1")]
	public class LockPickingLawyerPlugin : BaseUnityPlugin
	{
		private static LockPickingLawyerPlugin instance;

		private ManualLogSource logSource;

		private Harmony harmony;

		public static AudioClip lockPickingAudio;

		public static AudioClip finishPickingAudio;

		private void Awake()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			logSource = Logger.CreateLogSource("ainavt.lc.lockpickinglawyer");
			harmony = new Harmony("ainavt.lc.lockpickinglawyer");
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(typeof(LockPickingLawyerPlugin)).Location), "ainavt_lockpickinglawyer"));
			if ((Object)(object)val == (Object)null)
			{
				logSource.LogError((object)"Failed to load asset bundle.");
				return;
			}
			lockPickingAudio = val.LoadAsset<AudioClip>("Assets/mods/lockpickinglawyer/LockPickerPicking.ogg");
			finishPickingAudio = val.LoadAsset<AudioClip>("Assets/mods/lockpickinglawyer/LockPickerFinish.ogg");
			harmony.PatchAll(typeof(LockPickerPatch));
		}
	}
	internal static class PluginInfo
	{
		public const string guid = "ainavt.lc.lockpickinglawyer";

		public const string name = "LockPickingLawyer";

		public const string version = "0.0.1";
	}
}
namespace LockPickingLawyer.Patches
{
	[HarmonyPatch(typeof(LockPicker))]
	internal class LockPickerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void StartPatch(ref LockPicker __instance)
		{
			__instance.finishPickingLockClips = (AudioClip[])(object)new AudioClip[1] { LockPickingLawyerPlugin.finishPickingAudio };
			((Component)__instance).GetComponent<AudioSource>().clip = LockPickingLawyerPlugin.lockPickingAudio;
		}
	}
}