Add project

This commit is contained in:
Allen Wolf
2024-01-10 00:34:13 -06:00
parent d28b86bacc
commit 883f99db97
12 changed files with 1909 additions and 0 deletions

39
src/Spotify.cs Executable file
View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace SpotifyMod
{
class Spotify
{
static Process Process;
public static IntPtr MainWindowHandle => Process.MainWindowHandle;
public static int Id => Process.Id;
public static bool IsNull()
{
if (Process == null)
{
var processes = Process.GetProcessesByName("Spotify");
if (processes.Length == 0)
return true;
Process = processes[0];
Process.EnableRaisingEvents = true;
Process.Exited += (s, eargs) =>
{
SpotifyClosed();
};
}
return false;
}
static void SpotifyClosed()
{
Process = null;
}
}
}