static bool gameRunning() { int gameRun = 0; if (File.Exists(@"gameList.txt")) {} else { UpdateWindow updateForm = new UpdateWindow(); updateForm.Show(); System.Threading.Thread.Sleep(2000); } string[] games = System.IO.File.ReadAllLines(@"gameList.txt"); Process[] processes = Process.GetProcesses(); string[] proc = processes.Select(o => o.ToString()).ToArray(); var intersect = games.Intersect(proc); foreach (string g in games) { if (CheckIfProcessIsRunning(g)) { gameRun++; Console.WriteLine(gameRun); Console.WriteLine(g); return true; } } if (gameRun > 0) { return true; } else { return false; } }
private void metroTile2_Click(object sender, EventArgs e) { if (File.Exists(@"gameList.txt")) { Process.Start(@"gameList.txt"); } else { UpdateWindow updateForm = new UpdateWindow(); updateForm.Show(); } }
private void metroTile1_Click(object sender, EventArgs e) { UpdateWindow updateForm = new UpdateWindow(); updateForm.Show(); }