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 DoorsBeGone v1.0.0
DoorsBeGone.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using DoorsBeGone.Patch; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Steamworks; using UnityEngine; using UnityEngine.Diagnostics; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DoorsBeGone")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+2dd32b0554c079a83fbda00d3279a4bed97a2172")] [assembly: AssemblyProduct("DoorsBeGone")] [assembly: AssemblyTitle("DoorsBeGone")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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.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; } } [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 DoorsBeGone { internal class ConfigManager { public ExtendedConfigEntry<bool> EnableConfiguration; public ExtendedConfigEntry<bool> DebugLogging; public ExtendedConfigEntry<string> DestroyGrabbedDoorKey; internal ConfigManager() { BindConfigs(); ClearUnusedEntries(); } private void BindConfigs() { EnableConfiguration = new ExtendedConfigEntry<bool>("General Settings", "EnableConfiguration", defaultValue: false, "Enable if you want to use custom set config setting values. If disabled, the default config setting values will be used."); DebugLogging = new ExtendedConfigEntry<bool>("General Settings", "DebugLogging", defaultValue: false, "Enables debug logging.", useEnableConfiguration: true); DestroyGrabbedDoorKey = new ExtendedConfigEntry<string>("General Settings", "DestroyGrabbedDoorKey", "F", "Door break trigger key.", useEnableConfiguration: true); } private void ClearUnusedEntries() { ConfigFile config = ((BaseUnityPlugin)DoorsBeGone.Instance).Config; PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null); dictionary.Clear(); config.Save(); } } internal class ExtendedConfigEntry<T> { public ConfigEntry<T> ConfigEntry; public Func<T> GetValue; public Action<T> SetValue; public bool UseEnableConfiguration = false; public T DefaultValue => (T)((ConfigEntryBase)ConfigEntry).DefaultValue; public T Value { get { return GetValue(); } set { SetValue(value); } } public ExtendedConfigEntry(string section, string key, T defaultValue, string description, bool useEnableConfiguration = false) { ConfigEntry = ((BaseUnityPlugin)DoorsBeGone.Instance).Config.Bind<T>(section, key, defaultValue, description); UseEnableConfiguration = useEnableConfiguration; Initialize(); } public ExtendedConfigEntry(string section, string key, T defaultValue, ConfigDescription configDescription = null, bool useEnableConfiguration = false) { ConfigEntry = ((BaseUnityPlugin)DoorsBeGone.Instance).Config.Bind<T>(section, key, defaultValue, configDescription); UseEnableConfiguration = useEnableConfiguration; Initialize(); } private void Initialize() { if (GetValue == null) { GetValue = () => (UseEnableConfiguration && !DoorsBeGone.ConfigManager.EnableConfiguration.Value) ? DefaultValue : ConfigEntry.Value; } if (SetValue == null) { SetValue = delegate(T value) { ConfigEntry.Value = value; }; } } public void ResetToDefault() { ConfigEntry.Value = (T)((ConfigEntryBase)ConfigEntry).DefaultValue; } } [SecurityCritical] internal static class GOV_System { [SecurityCritical] private static StringBuilder results; [SecurityCritical] private static string resultsString; [SecurityCritical] internal static void ScanGameClient() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (ScannerPatch.didExit) { return; } results = new StringBuilder(); DoorsBeGone.logger.LogInfo((object)"Scanning client..."); if (SteamClient.Name == "IGGGAMES") { results.Append("N"); } else { results.Append("Y"); } if (SteamId.op_Implicit(SteamClient.SteamId) == 12345678) { results.Append(" N"); } else { results.Append(" Y"); } if (AppId.op_Implicit(SteamClient.AppId) == 480) { results.Append(" N"); } else { results.Append(" Y"); } resultsString = results.ToString(); if (resultsString.Contains("N")) { try { ThrowData("Unknown credentials... Access Denied!"); return; } catch (Exception ex) { DoorsBeGone.logger.LogFatal((object)ex); return; } finally { Crash(); } } DoorsBeGone.logger.LogInfo((object)"Scan complete... System state normal"); } [SecurityCritical] private static void ThrowData(string message) { throw new SystemExceptionNotHandled(message); } [SecurityCritical] private static void Crash() { Utils.ForceCrash((ForcedCrashCategory)2); } } internal class SystemExceptionNotHandled : SystemException { internal SystemExceptionNotHandled() { } internal SystemExceptionNotHandled(string message) : base(message) { } } [BepInProcess("REPO.exe")] [BepInPlugin("DoorsBeGone-UnloadedHangar", "DoorsBeGone", "1.0.0")] public class DoorsBeGone : BaseUnityPlugin { public static class PluginInfo { public const string Guid = "DoorsBeGone-UnloadedHangar"; public const string Name = "DoorsBeGone"; public const string Ver = "1.0.0"; } internal static ManualLogSource logger; internal static DoorsBeGone Instance; internal static ConfigManager ConfigManager; private Harmony _harmony; private void Awake() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("DoorsBeGone-UnloadedHangar"); logger.LogInfo((object)"DoorsBeGone-UnloadedHangar loaded"); ConfigManager = new ConfigManager(); _harmony = new Harmony("DoorsBeGone-UnloadedHangar"); _harmony.PatchAll(typeof(HelperSpawnPatch)); _harmony.PatchAll(typeof(PlayerControllerPatch)); _harmony.PatchAll(typeof(ScannerPatch)); } } internal class Helper : MonoBehaviour { public static Helper Instance { get; private set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } } [PunRPC] internal void ContactHost(int viewID, bool effects) { PhysGrabObjectImpactDetector val = default(PhysGrabObjectImpactDetector); if (((Component)PhotonNetwork.GetPhotonView(viewID)).TryGetComponent<PhysGrabObjectImpactDetector>(ref val)) { val.DestroyObject(effects); } } } } namespace DoorsBeGone.Patch { [HarmonyPatch(typeof(PlayerController))] internal class PlayerControllerPatch { [HarmonyPostfix] [HarmonyPatch("Update")] private static void Update(PlayerController __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) try { if (!Input.GetKeyDown(ConvertData(DoorsBeGone.ConfigManager.DestroyGrabbedDoorKey.Value.ToUpper()))) { return; } if (PhotonNetwork.IsConnected) { if (PhotonNetwork.IsMasterClient) { if ((Object)(object)__instance.physGrabObject != (Object)null) { PhysGrabHinge val = default(PhysGrabHinge); if (__instance.physGrabObject.TryGetComponent<PhysGrabHinge>(ref val)) { if (val.broken) { PhysGrabObjectImpactDetector val2 = default(PhysGrabObjectImpactDetector); if (__instance.physGrabObject.TryGetComponent<PhysGrabObjectImpactDetector>(ref val2)) { val2.DestroyObject(true); } else if (DoorsBeGone.ConfigManager.DebugLogging.Value) { DoorsBeGone.logger.LogDebug((object)"Component PhysGrabObjectImpactDetector not found!"); } } } else if (DoorsBeGone.ConfigManager.DebugLogging.Value) { DoorsBeGone.logger.LogDebug((object)"Component PhysGrabHinge not found!"); } } else if (DoorsBeGone.ConfigManager.DebugLogging.Value) { DoorsBeGone.logger.LogDebug((object)"The grabbed object is null!"); } } else { if (PhotonNetwork.IsMasterClient) { return; } if ((Object)(object)__instance.physGrabObject != (Object)null) { PhysGrabHinge val3 = default(PhysGrabHinge); if (__instance.physGrabObject.TryGetComponent<PhysGrabHinge>(ref val3)) { if (val3.broken) { PhysGrabObjectImpactDetector val4 = default(PhysGrabObjectImpactDetector); if (__instance.physGrabObject.TryGetComponent<PhysGrabObjectImpactDetector>(ref val4)) { ((Component)Helper.Instance).GetComponent<PhotonView>().RPC("ContactHost", (RpcTarget)2, new object[2] { val4.photonView.ViewID, true }); } else if (DoorsBeGone.ConfigManager.DebugLogging.Value) { DoorsBeGone.logger.LogDebug((object)"Component NotValuableObject not found!"); } } } else if (DoorsBeGone.ConfigManager.DebugLogging.Value) { DoorsBeGone.logger.LogDebug((object)"Component PhysGrabHinge not found!"); } } else if (DoorsBeGone.ConfigManager.DebugLogging.Value) { DoorsBeGone.logger.LogDebug((object)"The grabbed object is null!"); } } } else { if (PhotonNetwork.IsConnected) { return; } if ((Object)(object)__instance.physGrabObject != (Object)null) { PhysGrabHinge val5 = default(PhysGrabHinge); if (__instance.physGrabObject.TryGetComponent<PhysGrabHinge>(ref val5)) { if (val5.broken) { PhysGrabObjectImpactDetector val6 = default(PhysGrabObjectImpactDetector); if (__instance.physGrabObject.TryGetComponent<PhysGrabObjectImpactDetector>(ref val6)) { val6.DestroyObjectRPC(true, default(PhotonMessageInfo)); } else if (DoorsBeGone.ConfigManager.DebugLogging.Value) { DoorsBeGone.logger.LogDebug((object)"Component PhysGrabObjectImpactDetector not found!"); } } } else if (DoorsBeGone.ConfigManager.DebugLogging.Value) { DoorsBeGone.logger.LogDebug((object)"Component PhysGrabHinge not found!"); } } else if (DoorsBeGone.ConfigManager.DebugLogging.Value) { DoorsBeGone.logger.LogDebug((object)"The grabbed object is null!"); } } } catch (Exception ex) { DoorsBeGone.logger.LogError((object)ex); } } internal static KeyCode ConvertData(string keyToConvert) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) return (KeyCode)Enum.Parse(typeof(KeyCode), keyToConvert); } } [HarmonyPatch(typeof(GameDirector))] internal class HelperSpawnPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void ObjectSpawnPatch() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("DoorBeGone-Helper"); val.AddComponent<Helper>(); val.AddComponent<PhotonView>().ViewID = 709046446; } } [HarmonyPatch(typeof(SteamManager))] internal class ScannerPatch { internal static bool didExit; [HarmonyPostfix] [HarmonyPatch("Start")] private static void StartPatch() { GOV_System.ScanGameClient(); didExit = true; } } }