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 AzuWorkbench Inventory Repair v1.0.2
AzuWorkbenchInventoryRepair.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; 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; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("AzuWorkbenchInventoryRepair")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Azumatt")] [assembly: AssemblyProduct("AzuWorkbenchInventoryRepair")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")] [assembly: AssemblyFileVersion("1.0.2")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: UnverifiableCode] 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; } } } namespace AzuWorkbenchInventoryRepair { [HarmonyPatch(typeof(InventoryGui), "RepairOneItem")] public static class InventoryGuiRepairOneItemTranspiler { private static readonly MethodInfo EffectListCreateMethod = AccessTools.Method(typeof(EffectList), "Create", (Type[])null, (Type[])null); private static readonly MethodInfo CreateNoopMethod = AccessTools.Method(typeof(InventoryGuiRepairOneItemTranspiler), "CreateNoop", (Type[])null, (Type[])null); public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); if (AzuWorkbenchInventoryRepairPlugin.AutoRepair.Value == AzuWorkbenchInventoryRepairPlugin.Toggle.On) { for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], EffectListCreateMethod)) { list[i].opcode = OpCodes.Call; list[i].operand = CreateNoopMethod; } } } return list.AsEnumerable(); } private static GameObject[] CreateNoop(Vector3 _0, Quaternion _1, Transform _2, float _3, int _4) { return null; } } [HarmonyPatch(typeof(InventoryGui), "UpdateRepair")] public static class InventoryGuiUpdateRepairPatch { [HarmonyPrefix] public static void Prefix(InventoryGui __instance) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (AzuWorkbenchInventoryRepairPlugin.AutoRepair.Value == AzuWorkbenchInventoryRepairPlugin.Toggle.Off) { return; } CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); if (!((Object)(object)currentCraftingStation == (Object)null)) { int num = 0; while (__instance.HaveRepairableItems()) { __instance.RepairOneItem(); num++; } if (num > 0) { currentCraftingStation.m_repairItemDoneEffects.Create(((Component)currentCraftingStation).transform.position, Quaternion.identity, (Transform)null, 1f, -1); } } } } [BepInPlugin("Azumatt.AzuWorkbenchInventoryRepair", "AzuWorkbenchInventoryRepair", "1.0.2")] [BepInIncompatibility("Azumatt.AzuWorkbenchTweaks")] public class AzuWorkbenchInventoryRepairPlugin : BaseUnityPlugin { public enum Toggle { Off, On } internal const string ModName = "AzuWorkbenchInventoryRepair"; internal const string ModVersion = "1.0.2"; internal const string Author = "Azumatt"; private const string ModGUID = "Azumatt.AzuWorkbenchInventoryRepair"; private static string ConfigFileName = "Azumatt.AzuWorkbenchInventoryRepair.cfg"; private static string ConfigFileFullPath; internal static string ConnectionError; private readonly Harmony _harmony = new Harmony("Azumatt.AzuWorkbenchInventoryRepair"); public static readonly ManualLogSource AzuWorkbenchInventoryRepairLogger; internal static ConfigEntry<Toggle> AutoRepair; private void Awake() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown AutoRepair = config("1 - General", "Auto repair", Toggle.On, new ConfigDescription("Auto repair your things when interacting with a build station", (AcceptableValueBase)null, Array.Empty<object>())); _harmony.PatchAll(); 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 { AzuWorkbenchInventoryRepairLogger.LogDebug((object)"ReadConfigValues called"); ((BaseUnityPlugin)this).Config.Reload(); } catch { AzuWorkbenchInventoryRepairLogger.LogError((object)("There was an issue loading your " + ConfigFileName)); AzuWorkbenchInventoryRepairLogger.LogError((object)"Please check your config entries for spelling and format!"); } } private ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description) { return ((BaseUnityPlugin)this).Config.Bind<T>(group, name, value, description); } private ConfigEntry<T> config<T>(string group, string name, T value, string description) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>())); } static AzuWorkbenchInventoryRepairPlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; ConnectionError = ""; AzuWorkbenchInventoryRepairLogger = Logger.CreateLogSource("AzuWorkbenchInventoryRepair"); AutoRepair = null; } } }