static void Main(string[] args)
        {
            bool debugMode = args.Contains("-debug");

            Cleanup();

            CurrentMapId = GetMapId();

            while (true)
            {
                Console.WriteLine("\n\n--------------------------\nPress ENTER to take a screenshot and start the calculation.");
                Console.WriteLine("Write 'map' to choose map.");

                var readLine = Console.ReadLine();

                if (readLine == "map")
                {
                    CurrentMapId = GetMapId();
                    continue;
                }

                Console.WriteLine("Taking screenshot in 3 seconds...");

                Thread.Sleep(3000);

                Console.WriteLine("Taking sceenshot.");

                var activeScreenCapture = ScreenCapturer.GetActiveScreenCapture(
                    ScreenBoundsCalculator.GetRectangleByScreenResolution(
                        ScreenResolution.FullHD));

                Console.WriteLine("Screenshot saved. Extracting hero data from screenshot.");

                IEnumerable <int> enemyHeroIds = HeroScreenshotIdentityExtractor.FindEnemyHeroesByScreenshot(activeScreenCapture);

                Console.WriteLine($"Enemy heroes found: { JsonConvert.SerializeObject(enemyHeroIds?.Select(heroId => new { Hero = MetaDataHelper.GetHeroNameById(heroId) }))}");
                Logger.Info($"Enemy heroes found: { JsonConvert.SerializeObject(enemyHeroIds?.Select(heroId => new { Hero = MetaDataHelper.GetHeroNameById(heroId) })) }");

                IEnumerable <int> friendlyHeroIds = HeroScreenshotIdentityExtractor.FindAlliedHeroesByScreenshot(activeScreenCapture);

                Console.WriteLine($"Friendly heroes found: { JsonConvert.SerializeObject(friendlyHeroIds?.Select(heroId => new { Hero = MetaDataHelper.GetHeroNameById(heroId) }))}");
                Logger.Info($"Friendly heroes found: { JsonConvert.SerializeObject(friendlyHeroIds?.Select(heroId => new { Hero = MetaDataHelper.GetHeroNameById(heroId) }))}");

                Console.WriteLine("Calculating winrates.");

                IEnumerable <int> bestHeroIds = StatisticsCalculator.GetBestOrderedHeroIdCountersForTeamComposition(
                    enemyHeroIds,
                    CurrentMapId);
                Console.WriteLine("Calculation finished.");

                Console.WriteLine($"\nBest hero to chose (in order): ");
                int i = 1;
                foreach (var heroId in bestHeroIds.Take(10))
                {
                    Console.WriteLine($"{i}. { MetaDataHelper.GetHeroNameById(heroId)} ");
                    i++;
                }
            }
        }
Example #2
0
        public void ScreenShot()
        {
            var activeScreenCapture = ScreenCapturer.GetActiveScreenCapture(
                ScreenBoundsCalculator.GetRectangleByScreenResolution(
                    ScreenResolution.FullHD));

            Assert.NotNull(activeScreenCapture);
        }