public static void launch(GOGGame game) { if (game == null) { return; } GOGGalaxy.launch(game.ID); }
public static void open(GOGGame game) { if (game == null) { return; } GOGGalaxy.open(game.ID); }
public static void launch(string id, Action callback = null) { // GOGGalaxy.launchWinapi(id); // old hacky way Process.Start(GOGRegistry.ClientExecutable, $@"/gameid {id} /command runGame"); GOGGalaxy.waitForStartup(); GOGGame game = GOGRegistry.Game(id); if (game?.ExecutableName?.Length > 0) { Thread.Sleep(5000); Process[] procs = Process.GetProcessesByName(game.ExecutableName.Replace(".exe", "")); if (procs?.Length > 0) { procs[0].WaitForExit(); } Thread.Sleep(5000); procs = Process.GetProcesses(); foreach (Process proc in procs) { try { if (normalize(proc.MainModule.FileName).StartsWith(normalize(game.Path))) { proc.WaitForExit(); break; } } catch {} } } callback?.Invoke(); }