static void Main(string[] args) { if (args == null) Console.WriteLine(); CreateGsifile(); Process[] pname = Process.GetProcessesByName("Dota2"); if (pname.Length == 0) { Console.WriteLine("Dota 2 is not running. Please start Dota 2."); Console.ReadLine(); Environment.Exit(0); } _gsl = new GameStateListener(4000); _gsl.NewGameState += OnNewGameState; if (!_gsl.Start()) { Console.WriteLine("GameStateListener could not start. Try running this program as Administrator. Exiting."); Console.ReadLine(); Environment.Exit(0); } Console.WriteLine("Listening for game integration calls..."); Console.WriteLine("Press ESC to quit"); do { while (!Console.KeyAvailable) { Thread.Sleep(1000); } } while (Console.ReadKey(true).Key != ConsoleKey.Escape); }
private void InitializeDotaGSI() { _gameStateListener = new GameStateListener(4000); _gameStateListener.NewGameState += OnNewGameState; if (!_gameStateListener.Start()) { MessageBox.Show( "GameStateListener could not start. Try running this program as Administrator.\r\nExiting."); Environment.Exit(0); } }