-
Notifications
You must be signed in to change notification settings - Fork 4
/
Program.cs
58 lines (53 loc) · 1.84 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Bheithir.Emulators;
namespace Bheithir
{
class Program
{
private static readonly Dictionary<string, Presence> emulators = new Dictionary<string, Presence>()
{
{ "dosbox", new DosBox() },
{ "fceux", new Fceux() },
{ "snes9x", new Snes9x() },
{ "fusion", new Fusion() },
{ "vbam", new Vbam() },
{ "mame", new Mame() }
};
private static void Main(string[] args)
{
bool success = false;
string emulator = "";
while(!success)
{
Console.WriteLine("What emulator are you using?");
Console.ForegroundColor = ConsoleColor.Cyan;
emulator = Console.ReadLine().ToLower();
if(emulators.ContainsKey(emulator))
break;
Console.ResetColor();
Console.WriteLine("You misspelled the emulator name or that emulator is not supported!\n");
}
Console.ResetColor();
Presence presence = emulators[emulator];
if (!Process.GetProcesses().Where(x => x.ProcessName.StartsWith(presence.ProcessName)).Any())
{
Console.WriteLine("The specified emulator was not found! Is it open?");
return;
}
presence.Initialize();
while(true)
{
presence.Update();
if(!Process.GetProcesses().Where(x => x.ProcessName.StartsWith(presence.ProcessName)).Any())
{
presence.Deinitialize();
Console.WriteLine("Thanks for using Bheithir!");
return;
}
}
}
}
}