コード例 #1
0
        // The main match method, takes a screen capture as argument
        // and tries to find matching ranks for player and opponent
        public static async Task <RankResult> Match(Bitmap bmp)
        {
            var result = new RankResult();

            if (bmp == null)
            {
                Log.Error("Captured image is null");
                return(result);
            }
            try
            {
                var capture = await Task.Run(() => ProcessImage(bmp));

                result.Player = await Task.Run(() => FindBest(capture.Player));

                result.Opponent = await Task.Run(() => FindBest(capture.Opponent));
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
            Log.Debug($"Match: P={result.Player}, O={result.Opponent}");
            return(result);
        }
コード例 #2
0
        // The main match method, takes a screen capture as argument
        // and tries to find matching ranks for player and opponent
        public static async Task <RankResult> Match(Bitmap bmp)
        {
            var result = new RankResult();

            if (bmp == null)
            {
                Logger.WriteLine("Captured image is null", "RankedDetection");
                return(result);
            }
            try
            {
                var capture = await Task.Run(() => ProcessImage(bmp));

                result.Player = await Task.Run(() => FindBest(capture.Player));

                result.Opponent = await Task.Run(() => FindBest(capture.Opponent));
            }
            catch (Exception e)
            {
                Logger.WriteLine("Failed: " + e.Message, "RankDetection");
            }
            Logger.WriteLine("Match: P=" + result.Player + ", O=" + result.Opponent, "RankedDetection", 1);
            return(result);
        }