public virtual async Task <TimeSpan?> TryGetTimerAsync() { Rectangle dimensions = CaptureStrategy.GetDimensions(WindowHandle); Bitmap?timer = CaptureStrategy.Capture(WindowHandle, new Rectangle(dimensions.Width / 2 - 50, 0, 100, 50)); if (timer == null) { return(null); } try { using (Bitmap resized = timer.GetResized(zoom: 2)) { OcrResult?result = await TryGetOcrResult(resized, Constants.Ocr.TIMER_HRS_MINS_SECONDS_SEPERATOR.ToString()); if (result != null) { return(TryParseTimeSpan(result)); } } } catch (Exception e) { Logger.LogError(e, e.Message); } finally { timer.Dispose(); } return(null); }
public HeroesOfTheStorm( ILogger <HeroesOfTheStorm> logger, IOptions <Settings> settings, CancellationTokenProvider tokenProvider, CaptureStrategy captureStrategy) : base(tokenProvider, captureStrategy, logger, settings, Constants.HEROES_PROCESS_NAME) { }
public StubOfTheStorm( ILogger <HeroesOfTheStorm> logger, IOptions <Settings> settings, CancellationTokenProvider tokenProvider, CaptureStrategy captureStrategy, ReplayHelper replayHelper) : base(logger, settings, tokenProvider, captureStrategy) { this.replayHelper = replayHelper; this.timer = TimeSpan.Zero; }
public ProcessWrapper( CancellationTokenProvider tokenProvider, CaptureStrategy captureStrategy, ILogger <ProcessWrapper> logger, IOptions <Settings> settings, string processName) { Logger = logger; Settings = settings.Value; this.tokenProvider = tokenProvider; CaptureStrategy = captureStrategy; ProcessName = processName; }