Decompiled source of Repo Lights Mod v1.0.2

RepoLightsMod.dll

Decompiled a month 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 BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RepoLightsMod.Manager;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("hjowe")]
[assembly: AssemblyConfiguration("release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RepoLightsMod")]
[assembly: AssemblyTitle("RepoLightsMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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;
		}
	}
}
namespace RepoLightsMod
{
	[BepInPlugin("hyuwi.repolightsmod", "REPO Lights Mod", "1.0.2")]
	internal class RepoLightsMod : BaseUnityPlugin
	{
		private const string modGUID = "hyuwi.repolightsmod";

		private const string modName = "REPO Lights Mod";

		private const string modVersion = "1.0.2";

		internal static RepoLightsMod? Instance;

		private readonly Harmony harmony = new Harmony("hyuwi.repolightsmod");

		internal static ManualLogSource? logger;

		private void Awake()
		{
			logger = Logger.CreateLogSource("REPO Lights Mod");
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			ConfigManager.Initialize(((BaseUnityPlugin)this).Config);
			harmony.PatchAll();
			logger.LogInfo((object)"REPO Lights Mod has awoken!");
		}
	}
}
namespace RepoLightsMod.Patches
{
	[HarmonyPatch(typeof(LightManager))]
	internal class LightManagerPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePatch(ref bool ___turnOffLights)
		{
			if (!ConfigManager.keepLightsOn.Value)
			{
				___turnOffLights = false;
				RepoLightsMod.logger.LogInfo((object)"Keep Lights On set to: false");
			}
			else
			{
				___turnOffLights = true;
				RepoLightsMod.logger.LogInfo((object)"Keep Lights On set to: true");
			}
		}
	}
}
namespace RepoLightsMod.Manager
{
	internal class ConfigManager
	{
		internal static ConfigEntry<bool>? keepLightsOn;

		internal static void Initialize(ConfigFile cfg)
		{
			keepLightsOn = cfg.Bind<bool>("General", "Keep Lights On", true, "Set if you want to keep the lights on after the final extraction is completed.");
		}
	}
}