Exemple #1
0
        public void LookForStats(IntPtr mainWindowHandle)
        {
            Bitmap screen = (Bitmap)_screenshotter.CaptureWindow(mainWindowHandle);

            if (CurrentState == GameState.Scorescreen)
            {
                LookforSR(screen, _currentGame);
                return;
            }

            var result = StatScrapper.DetermineGameResult(screen);

            if (result == GameResult.Uncertain)
            {
                return;
            }

            Directory.CreateDirectory("./games/" + _currentGame.Id);
            _sw.Start();
            CurrentState = GameState.Scorescreen;
            Console.WriteLine("Current state: " + CurrentState);
            _currentGame             = StatScrapper.MapAndTime(_currentGame, screen, result);
            _currentGame.Result      = result;
            _currentGame.CompletedAt = DateTime.Now;
        }
Exemple #2
0
 public void StartPolling()
 {
     while (true)
     {
         Console.WriteLine("Trying to find overwatch process");
         var process = GetOverwatchProcess();
         _gameRunning = true;
         process.EnableRaisingEvents = true;
         process.Exited += OnOverwatchExit;
         Console.WriteLine("Process found! Doing some kind of loop while game is running...");
         while (_gameRunning)
         {
             using (var screenshot = new Bitmap(_screenshotter.CaptureWindow(process.MainWindowHandle)))
             {
                 Console.WriteLine(_parser.GetFpsFromImage(screenshot));
             }
             Thread.Sleep(3000);
         }
     }
 }