using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using Enemy;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("DvdEject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DvdEject")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("319a9199-c055-40de-8ea0-378ff577f7f2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DvdEject;
[BepInPlugin("patman.iamyourbeast.dvdeject", "-eject", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(EnemyHuman))]
public class KillEnemy
{
[HarmonyPatch("Kill")]
[HarmonyPostfix]
public static void Postfix()
{
CloseDrive();
}
}
[HarmonyPatch(typeof(PlayerHealthManager))]
public class PlayerDamage
{
[HarmonyPatch("Damage")]
[HarmonyPostfix]
public static void Postfix()
{
OpenDrive();
}
}
private static string loadBearingColonThree = ":3";
public const string pluginGuid = "patman.iamyourbeast.dvdeject";
public const string pluginName = "-eject";
public const string pluginVersion = "1.0.1";
public void Awake()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
if (loadBearingColonThree != ":3")
{
Application.Quit();
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"your dvd drive is: damn ejected");
new Harmony("patman.iamyourbeast.dvdeject").PatchAll();
}
[DllImport("winmm.dll")]
protected static extern int mciSendString(string command, string buffer, int bufferSize, IntPtr hwndCallback);
public static void OpenDrive()
{
Task.Run(() => mciSendString("set CDAudio door open", "", 127, IntPtr.Zero));
}
public static void CloseDrive()
{
Task.Run(() => mciSendString("set CDAudio door closed", "", 127, IntPtr.Zero));
}
}