Exemplo n.º 1
0
 public static void launch(GOGGame game)
 {
     if (game == null)
     {
         return;
     }
     GOGGalaxy.launch(game.ID);
 }
Exemplo n.º 2
0
 public static void open(GOGGame game)
 {
     if (game == null)
     {
         return;
     }
     GOGGalaxy.open(game.ID);
 }
Exemplo n.º 3
0
        private static void launchWinapi(string id)
        {
            GOGGalaxy.open(id);

            IntPtr hwnd = GOGGalaxy.waitForStartup();

            WinAPI.SetForegroundWindow(hwnd);
            WinAPI.Click(hwnd, new System.Drawing.Point(_x, _y));
        }
Exemplo n.º 4
0
        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();
        }