Decompiled source of LongerDays LC v1.0.0

plugins/LongerDays_LC/LongerDays_LC.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 System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LongerDays_LC.Configuration;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Camerin Figueroa")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © RaspberryProgramming 2023")]
[assembly: AssemblyDescription("Lethal Company Mod to change the length of each day in game.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LongerDays_LC")]
[assembly: AssemblyTitle("LongerDays_LC")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/RaspberryProgramming/LongerDays_LC")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LongerDays_LC
{
	[BepInPlugin("com.github.raspberryprogramming.LongerDays_LC", "LongerDays_LC", "1.0")]
	internal class LongerDays_LCPlugin : BaseUnityPlugin
	{
		public const string GUID = "com.github.raspberryprogramming.LongerDays_LC";

		public const string NAME = "LongerDays_LC";

		public const string VERSION = "1.0";

		public static ManualLogSource Log;

		private void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogMessage((object)"Starting LongerDays_LC Patching");
			Config.Init();
			new Harmony("com.github.raspberryprogramming.LongerDays_LC").PatchAll(Assembly.GetExecutingAssembly());
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LongerDays_LC";

		public const string PLUGIN_NAME = "LongerDays_LC";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LongerDays_LC.LongerDays_LC.Patches
{
	[HarmonyPatch(typeof(TimeOfDay), "Start")]
	internal class TimeOfDayPatches
	{
		public static void Prefix(ref TimeOfDay __instance)
		{
			LongerDays_LCPlugin.Log.LogMessage((object)$"Config.LengthOfHoursMod={Config.LengthOfHoursMod}");
			if (Config.LengthOfHoursMod > 0f)
			{
				__instance.lengthOfHours = Config.LengthOfHoursMod;
				LongerDays_LCPlugin.Log.LogMessage((object)$"lengthOfHours value={__instance.lengthOfHours}");
			}
		}
	}
}
namespace LongerDays_LC.Configuration
{
	internal static class Config
	{
		private const string CONFIG_FILE_NAME = "LongerDays_LC.cfg";

		private static ConfigFile _config;

		private static ConfigEntry<float> _lengthOfHoursMod;

		public static float LengthOfHoursMod => _lengthOfHoursMod.Value;

		public static void Init()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			LongerDays_LCPlugin.Log.LogMessage((object)"Initializing config...");
			_config = new ConfigFile(Path.Combine(Paths.ConfigPath, "LongerDays_LC.cfg"), true);
			_lengthOfHoursMod = _config.Bind<float>("Config", "Length Of Hours Modifier", 100f, "Sets the modifier for determining length of an hour ingame.");
			LongerDays_LCPlugin.Log.LogMessage((object)"Config initialized!");
		}

		private static void PrintConfig()
		{
			LongerDays_LCPlugin.Log.LogMessage((object)$"Length Of Hours Modifier: {_lengthOfHoursMod.Value}");
		}
	}
}