Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Fuel Daylight Saving v0.4.1
plugins/FuelDaylightSaving.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; 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 Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyCompany("FuelDaylightSaving")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.4.1.0")] [assembly: AssemblyInformationalVersion("0.4.1+21dda15ae8ed1810c9e0fd94421233fbbba1eaf9")] [assembly: AssemblyProduct("FuelDaylightSaving")] [assembly: AssemblyTitle("FuelDaylightSaving")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.4.1.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 FuelDaylightSaving { public class Patches { [HarmonyPostfix] [HarmonyPatch(typeof(Fireplace), "IsBurning")] private static void DisableFireplacesInDaylight(Fireplace __instance, ref bool __result) { if (!__result || __instance.m_infiniteFuel || Plugin.ExceptionList.Contains(((Object)__instance).name)) { return; } EnvSetup currentEnvironment = EnvMan.instance.GetCurrentEnvironment(); if (currentEnvironment == null || !currentEnvironment.m_alwaysDark) { float dayFraction = EnvMan.instance.GetDayFraction(); if (dayFraction >= 0.29f && dayFraction <= 0.71f) { __result = false; } } } } [BepInPlugin("nbusseneau.FuelDaylightSaving", "FuelDaylightSaving", "0.4.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string ModGUID = "nbusseneau.FuelDaylightSaving"; private const string ModName = "FuelDaylightSaving"; private const string ModVersion = "0.4.1"; private static readonly List<string> s_defaultExceptionList = new List<string>(3) { "fire_pit", "hearth", "BRP_RefinedStone_Hearth" }; private static ConfigEntry<string> s_exceptionList; public static HashSet<string> ExceptionList { get; private set; } private static HashSet<string> ParseExceptionList(string serializedExceptionList) { return (from prefabName in serializedExceptionList.Split(new char[1] { ',' }) select prefabName.Trim() + "(Clone)").ToHashSet(); } public void Awake() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) ConfigurationManagerAttributes val = new ConfigurationManagerAttributes { IsAdminOnly = true }; string text = "List of piece names whose fireplace should be kept lit at all times (e.g. because you want to use them for cooking stations or as comfort providers)."; s_exceptionList = ((BaseUnityPlugin)this).Config.Bind<string>("Behaviour", "Exception list", GeneralExtensions.Join<string>((IEnumerable<string>)s_defaultExceptionList, (Func<string, string>)null, ", "), new ConfigDescription(text, (AcceptableValueBase)null, new object[1] { val })); ExceptionList = ParseExceptionList(s_exceptionList.Value); s_exceptionList.SettingChanged += delegate { ExceptionList = ParseExceptionList(s_exceptionList.Value); }; SetUpConfigWatcher(); new Harmony("nbusseneau.FuelDaylightSaving").PatchAll(typeof(Patches)); } public void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private void SetUpConfigWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, Path.GetFileName(((BaseUnityPlugin)this).Config.ConfigFilePath)); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(((BaseUnityPlugin)this).Config.ConfigFilePath)) { return; } try { ((BaseUnityPlugin)this).Logger.LogDebug((object)"Attempting to reload configuration..."); ((BaseUnityPlugin)this).Config.Reload(); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)("There was an issue loading " + ((BaseUnityPlugin)this).Config.ConfigFilePath)); } } } }