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 TebInfiniteTorches v0.1.1
TebInfiniteTorches.dll
Decompiled 2 years agousing System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("TebInfiniteTorches")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TebInfiniteTorches")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("15a8f886-d8c4-441b-88c1-817b64ce1713")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace TebInfiniteTorches; [HarmonyPatch(typeof(Fireplace), "Awake")] internal static class InfiniteFuel { [HarmonyPostfix] private static void InfiniteFuelPrefix(Fireplace __instance) { if (Plugin.GetInfiniteFuel()) { __instance.m_infiniteFuel = true; } } } [HarmonyPatch(typeof(Fireplace), "CheckWet")] internal static class WeatherBlock { [HarmonyPrefix] private static bool WeatherBlockPrefix(Fireplace __instance) { if (Plugin.GetWeather()) { __instance.m_wet = false; return false; } return true; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.tebbeh.mod.tebbehInfiniteTorches", "tebbehInfiniteTorches", "0.1.1")] public class Plugin : BaseUnityPlugin { private const string ModName = "tebbehInfiniteTorches"; private const string ModVersion = "0.1.1"; private const string Author = "com.tebbeh.mod"; private const string ModGUID = "com.tebbeh.mod.tebbehInfiniteTorches"; private static string ConfigFileName = "com.tebbeh.mod.tebbehInfiniteTorches.cfg"; private static string ConfigFileFullPath; private readonly Harmony HarmonyInstance = new Harmony("com.tebbeh.mod.tebbehInfiniteTorches"); public static readonly ManualLogSource InfiniteTorchesLogger; internal static ConfigEntry<bool> AdminBypass; internal static ConfigEntry<bool> infiniteFuel; internal static ConfigEntry<bool> weatherBlock; private readonly ConfigurationManagerAttributes AdminConfig = new ConfigurationManagerAttributes { IsAdminOnly = true }; private readonly ConfigurationManagerAttributes ClientConfig = new ConfigurationManagerAttributes { IsAdminOnly = false }; public static bool GetAdminBypass() { return AdminBypass.Value; } public static bool GetInfiniteFuel() { return infiniteFuel.Value; } public static bool GetWeather() { return weatherBlock.Value; } private void AddConfig<T>(string key, string section, string description, bool synced, T value, ref ConfigEntry<T> configEntry) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown string extendedDescription = GetExtendedDescription(description, synced); configEntry = ((BaseUnityPlugin)this).Config.Bind<T>(section, key, value, new ConfigDescription(extendedDescription, (AcceptableValueBase)null, new object[1] { synced ? AdminConfig : ClientConfig })); } public string GetExtendedDescription(string description, bool synchronizedSetting) { return description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"); } private void Awake() { AddConfig("AdminBypass", "General", "True to allow admins to bypass some setting restrictions (boolean).", synced: true, value: true, ref AdminBypass); AddConfig("InfiniteFuel", "Misc", "Apply infinite to all types of fireplaces (boolean).", synced: true, value: true, ref infiniteFuel); AddConfig("WeatherBlock", "Misc", "Apply weather block to all types of fireplaces (boolean).", synced: true, value: true, ref weatherBlock); Assembly executingAssembly = Assembly.GetExecutingAssembly(); HarmonyInstance.PatchAll(executingAssembly); SetupWatcher(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); 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(ConfigFileFullPath)) { return; } try { InfiniteTorchesLogger.LogDebug((object)"[TebInfiniteTorches] Attempting to reload configuration..."); ((BaseUnityPlugin)this).Config.Reload(); } catch { InfiniteTorchesLogger.LogError((object)("[TebInfiniteTorches] There was an issue loading " + ConfigFileName)); } } static Plugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; InfiniteTorchesLogger = Logger.CreateLogSource("tebbehInfiniteTorches"); AdminBypass = null; infiniteFuel = null; weatherBlock = null; } }