Decompiled source of FlashlightAngleFix v1.0.0

BepInEx/plugins/FlashlightAngleFix.dll

Decompiled an hour ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("FlashlightAngleFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Fix your angles")]
[assembly: AssemblyTitle("FlashlightAngleFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("com.oworope.flashlightanglefix", "FlashlightAngleFix", "1.0.0")]
public class FlashlightAngleFixPlugin : BaseUnityPlugin
{
	public static ConfigEntry<float> HeadlampAngle;

	public static ConfigEntry<float> FlashlightAngle;

	private void Awake()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Expected O, but got Unknown
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		HeadlampAngle = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Headlamp Angle", 150f, new ConfigDescription("Target angle for the Headlamp_Lamp object.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 360f), Array.Empty<object>()));
		FlashlightAngle = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Flashlight Angle", 150f, new ConfigDescription("Target angle for all flashlights.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 360f), Array.Empty<object>()));
		new Harmony("com.oworope.flashlightanglefix").PatchAll();
	}
}
[HarmonyPatch(typeof(CL_Lamp), "Awake")]
public static class CLLampAwakePatch
{
	public static void Postfix(CL_Lamp __instance)
	{
		if (((Object)((Component)__instance).gameObject).name.Contains("Headlamp_Lamp"))
		{
			__instance.angle = FlashlightAngleFixPlugin.HeadlampAngle.Value;
		}
	}
}
[HarmonyPatch(typeof(Item_Object_Flashlight), "Start")]
public static class FlashlightStartPatch
{
	public static void Postfix(Item_Object_Flashlight __instance)
	{
		if ((Object)(object)__instance.lamp != (Object)null)
		{
			__instance.lamp.angle = FlashlightAngleFixPlugin.FlashlightAngle.Value;
		}
	}
}
namespace FlashlightAngleFix
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "FlashlightAngleFix";

		public const string PLUGIN_NAME = "Fix your angles";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}