using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using JG224.JotunnCompatibilityPatch.Preloader; using JG224.ModCore.API; using Microsoft.CodeAnalysis; using UnityEngine; [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("JG224.JotunnCompatibilityPatch")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.5.0.0")] [assembly: AssemblyInformationalVersion("0.5.0")] [assembly: AssemblyProduct("JG224.JotunnCompatibilityPatch")] [assembly: AssemblyTitle("JG224.JotunnCompatibilityPatch")] [assembly: AssemblyVersion("0.5.0.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 JG224.JotunnCompatibilityPatch { [BepInPlugin("com.jg224.jotunncompatibilitypatch", "Jotunn Compatibility Patch", "0.5.0")] [BepInDependency("com.jg224.modcore", "0.5.0")] [BepInDependency("com.jotunn.jotunn", "2.29.2")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.jg224.jotunncompatibilitypatch"; public const string PluginName = "Jotunn Compatibility Patch"; public const string PluginVersion = "0.5.0"; public const int ProtocolVersion = 1; public static readonly ModuleId ModuleId = new ModuleId("jotunncompatibilitypatch"); private ICoreServices _core; private IDisposable _registration; private void Awake() { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) try { if (!ModCoreApi.IsAvailable) { throw new InvalidOperationException("ModCore did not initialize before the compatibility reporter."); } _core = ModCoreApi.Services; SemanticVersion val = default(SemanticVersion); if (!SemanticVersion.TryParse("0.5.0", ref val)) { throw new InvalidOperationException("Invalid add-on version."); } _registration = _core.Modules.Register(new ModuleDescriptor(ModuleId, "com.jg224.jotunncompatibilitypatch", "Jotunn Compatibility Patch", val, 1, (ModuleSide)3, (ModuleRequirement)4, 0uL, 1, 1)); if (!Loader.Applied || Loader.InputHash != "F65751BC15E7AE7466B0F7D3B38C758397741C99A50890DEB19ACF738376BFB1" || Loader.FailureReason != null || !Chainloader.PluginInfos.TryGetValue("com.jotunn.jotunn", out var value) || (Object)(object)value.Instance == (Object)null || (object)((object)value.Instance).GetType().Assembly != Loader.LoadedJotunn) { throw new InvalidOperationException("Validated preloader changes are not active on the loaded Jotunn instance. " + Loader.FailureReason); } _core.Modules.SetState(ModuleId, (ModuleRuntimeState)2, "Jotunn 2.29.2 compatibility changes active in memory; original DLL preserved."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Jotunn Compatibility Patch 0.5.0 loaded; matching add-on required on server and clients."); } catch (Exception ex) { if (_registration != null) { _core.Modules.SetState(ModuleId, (ModuleRuntimeState)5, ex.Message); } ((BaseUnityPlugin)this).Logger.LogError((object)("Jotunn compatibility initialization failed safely: " + ex)); ((Behaviour)this).enabled = false; } } private void OnDestroy() { _registration?.Dispose(); _registration = null; _core = null; } } }