Please disclose if any significant portion of your mod was created 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 BoatAdditions v1.0.1
AWLBoatAdditionsCompat.dll
Decompiled 5 days agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AWLBoatAdditionsCompat")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("AWLBoatAdditionsCompat")] [assembly: AssemblyTitle("AWLBoatAdditionsCompat")] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 AWLGaming.Valheim.BoatAdditionsCompat { [BepInPlugin("net.awlgaming.valheim.boatadditionscompat", "AWL BoatAdditions Valheim 1.0 Compatibility", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "net.awlgaming.valheim.boatadditionscompat"; public const string PluginName = "AWL BoatAdditions Valheim 1.0 Compatibility"; public const string PluginVersion = "1.0.1"; private const string BoatAdditionsGuid = "blacks7ar.BoatAdditions"; private void Awake() { //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) if (!Chainloader.PluginInfos.TryGetValue("blacks7ar.BoatAdditions", out var value)) { ((BaseUnityPlugin)this).Logger.LogError((object)"BoatAdditions is not loaded. Compatibility patch cannot be applied."); return; } Version version = value.Metadata.Version; if (version > new Version(1, 4, 2)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"BoatAdditions {version} is newer than the compatibility target. No patch applied."); return; } Type type = ((object)value.Instance).GetType().Assembly.GetType("PieceManager.PiecePrefabManager", throwOnError: false); if (type == null) { throw new TypeLoadException("BoatAdditions PieceManager.PiecePrefabManager was not found."); } MethodInfo stalePrefix = AccessTools.Method(type, "UpdateAvailable_Prefix", (Type[])null, (Type[])null) ?? throw new MissingMethodException("BoatAdditions UpdateAvailable_Prefix was not found."); MethodInfo stalePostfix = AccessTools.Method(type, "UpdateAvailable_Postfix", (Type[])null, (Type[])null) ?? throw new MissingMethodException("BoatAdditions UpdateAvailable_Postfix was not found."); MethodInfo methodInfo = AccessTools.DeclaredMethod(typeof(PieceTable), "UpdateAvailable", (Type[])null, (Type[])null) ?? throw new MissingMethodException("PieceTable.UpdateAvailable was not found."); Patches val = Harmony.GetPatchInfo((MethodBase)methodInfo) ?? throw new InvalidOperationException("PieceTable.UpdateAvailable has no Harmony patch info."); bool flag = val.Prefixes.Any((Patch p) => p.PatchMethod == stalePrefix); bool flag2 = val.Postfixes.Any((Patch p) => p.PatchMethod == stalePostfix); if (!flag || !flag2) { throw new InvalidOperationException($"Expected BoatAdditions stale hooks were not both present. prefix={flag}, postfix={flag2}"); } Harmony val2 = new Harmony("net.awlgaming.valheim.boatadditionscompat"); val2.Unpatch((MethodBase)methodInfo, stalePrefix); val2.Unpatch((MethodBase)methodInfo, stalePostfix); val = Harmony.GetPatchInfo((MethodBase)methodInfo) ?? throw new InvalidOperationException("PieceTable.UpdateAvailable patch info disappeared after compatibility patch."); if (val.Prefixes.Any((Patch p) => p.PatchMethod == stalePrefix) || val.Postfixes.Any((Patch p) => p.PatchMethod == stalePostfix)) { throw new InvalidOperationException("BoatAdditions stale PieceTable hooks are still active after unpatch."); } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"BoatAdditions {version} Valheim 1.0 compatibility active. Removed obsolete PieceTable availability hooks."); } } }