Update ScreenMatch.cs
Some checks are pending
CodeQL / Analyze (csharp) (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run

This commit is contained in:
Namhyeon Go 2024-08-25 18:07:31 +09:00
parent 18e81f71ba
commit 277eb08cba

View File

@ -63,6 +63,7 @@ public class ScreenMatch
private double threshold = 0.4;
private string mode;
private List<string> _params = new List<string>();
private bool searchFromEnd = false;
public ScreenMatch(ServiceBase parent, string workingDirectory)
{
@ -94,6 +95,12 @@ public class ScreenMatch
}
SetMode(screen_time_mode);
LoadTemplateImages();
if (_params.Contains("backward"))
{
searchFromEnd = true;
this.parent.Log("Use the backward search when screen time");
}
}
public void SetMode(string mode)
@ -296,8 +303,6 @@ public class ScreenMatch
Point bestMatch = Point.Empty;
maxCorrelation = 0;
bool searchFromEnd = _params.Contains("backward");
int startX = searchFromEnd ? mainWidth - templateWidth : 0;
int endX = searchFromEnd ? -1 : mainWidth - templateWidth + 1;
int stepX = searchFromEnd ? -1 : 1;