using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ForceQuit")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ForceQuit")]
[assembly: AssemblyTitle("ForceQuit")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[BepInPlugin("com.Bertogim.ForceQuit", "Force Quit", "1.0.0")]
[BepInProcess("Lethal Company.exe")]
public class ForceQuitMod : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__2_0;
internal void <PatchQuitButton>b__2_0()
{
Debug.Log((object)" [ForceQuit] Force quit triggered from main menu.");
Process.GetCurrentProcess().Kill();
}
}
private readonly Harmony _harmony = new Harmony("com.user.lethalcompany.forcequit");
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Force Quit Mod loaded!");
_harmony.PatchAll(typeof(ForceQuitMod));
}
[HarmonyPatch(typeof(MenuManager), "Awake")]
[HarmonyPostfix]
public static void PatchQuitButton(ref MenuManager __instance)
{
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Expected O, but got Unknown
if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.versionNumberText == (Object)null)
{
return;
}
Canvas componentInParent = ((Component)__instance.versionNumberText).GetComponentInParent<Canvas>();
if ((Object)(object)componentInParent == (Object)null)
{
return;
}
Button val = null;
TextMeshProUGUI[] componentsInChildren = ((Component)componentInParent).GetComponentsInChildren<TextMeshProUGUI>();
TextMeshProUGUI[] array = componentsInChildren;
foreach (TextMeshProUGUI val2 in array)
{
if (((TMP_Text)val2).text.Contains("Quit") && !((TMP_Text)val2).text.Contains("Quit to Desktop"))
{
val = ((Component)val2).GetComponentInParent<Button>();
if ((Object)(object)val != (Object)null)
{
break;
}
}
}
if ((Object)(object)val != (Object)null)
{
Debug.Log((object)" [ForceQuit] Quit button found.");
((UnityEventBase)val.onClick).RemoveAllListeners();
ButtonClickedEvent onClick = val.onClick;
object obj = <>c.<>9__2_0;
if (obj == null)
{
UnityAction val3 = delegate
{
Debug.Log((object)" [ForceQuit] Force quit triggered from main menu.");
Process.GetCurrentProcess().Kill();
};
<>c.<>9__2_0 = val3;
obj = (object)val3;
}
((UnityEvent)onClick).AddListener((UnityAction)obj);
}
else
{
Debug.LogWarning((object)" [ForceQuit] Force quit triggered from main menu.");
}
}
}