mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-12-11 18:12:51 +00:00
Update ScreenMatching.cs, ServiceMain.cs
This commit is contained in:
parent
cf34039f5a
commit
15bd7d40db
|
|
@ -51,10 +51,11 @@ public class ScreenMatching
|
||||||
public int Bottom;
|
public int Bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ServiceMain parent;
|
||||||
private List<Bitmap> templateImages;
|
private List<Bitmap> templateImages;
|
||||||
private string templateFolderPath;
|
private string templateFolderPath;
|
||||||
private int currentTemplateIndex = 0;
|
private int currentTemplateIndex = 0;
|
||||||
private ServiceMain parent;
|
private string captureMode;
|
||||||
|
|
||||||
public ScreenMatching(ServiceBase parent, string workingDirectory)
|
public ScreenMatching(ServiceBase parent, string workingDirectory)
|
||||||
{
|
{
|
||||||
|
|
@ -62,9 +63,15 @@ public class ScreenMatching
|
||||||
templateFolderPath = Path.Combine(workingDirectory, "app/assets/img/_templates");
|
templateFolderPath = Path.Combine(workingDirectory, "app/assets/img/_templates");
|
||||||
templateImages = new List<Bitmap>();
|
templateImages = new List<Bitmap>();
|
||||||
|
|
||||||
|
SetCaptureMode("screen");
|
||||||
LoadTemplateImages();
|
LoadTemplateImages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetCaptureMode(string captureMode)
|
||||||
|
{
|
||||||
|
this.captureMode = captureMode;
|
||||||
|
}
|
||||||
|
|
||||||
public void LoadTemplateImages()
|
public void LoadTemplateImages()
|
||||||
{
|
{
|
||||||
string[] files;
|
string[] files;
|
||||||
|
|
@ -87,6 +94,21 @@ public class ScreenMatching
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 캡쳐 및 템플릿 매칭 진행
|
||||||
|
public List<ScreenMatchResult> CaptureAndMatch()
|
||||||
|
{
|
||||||
|
switch(captureMode)
|
||||||
|
{
|
||||||
|
case "screen": // 화면 기준
|
||||||
|
return CaptureAndMatchAllScreens();
|
||||||
|
|
||||||
|
case "windows": // 윈도우 핸들 기준
|
||||||
|
return CaptureAndMatchAllWindows();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new List<ScreenMatchResult>();
|
||||||
|
}
|
||||||
|
|
||||||
// 화면을 기준으로 찾기
|
// 화면을 기준으로 찾기
|
||||||
public List<ScreenMatchResult> CaptureAndMatchAllScreens()
|
public List<ScreenMatchResult> CaptureAndMatchAllScreens()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ namespace WelsonJS.Service
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<ScreenMatchResult> matchedResults = screenMatcher.CaptureAndMatchAllScreens();
|
List<ScreenMatchResult> matchedResults = screenMatcher.CaptureAndMatch();
|
||||||
matchedResults.ForEach(result =>
|
matchedResults.ForEach(result =>
|
||||||
{
|
{
|
||||||
if (result.MaxCorrelation > 0.0) {
|
if (result.MaxCorrelation > 0.0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user