mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 06:54:58 +00:00
Update ScreenMatch.cs
This commit is contained in:
parent
27e9a328d4
commit
c36d7fb71f
|
@ -369,8 +369,6 @@ public class ScreenMatch
|
||||||
}
|
}
|
||||||
|
|
||||||
Bitmap image = templateImages[templateCurrentIndex];
|
Bitmap image = templateImages[templateCurrentIndex];
|
||||||
parent.Log($"Trying match the template {image.Tag as string} on the screen {i}...");
|
|
||||||
|
|
||||||
string templateName = image.Tag as string;
|
string templateName = image.Tag as string;
|
||||||
Size templateSize = new Size
|
Size templateSize = new Size
|
||||||
{
|
{
|
||||||
|
@ -378,6 +376,8 @@ public class ScreenMatch
|
||||||
Height = image.Height
|
Height = image.Height
|
||||||
};
|
};
|
||||||
|
|
||||||
|
parent.Log($"Trying match the template {templateName} on the screen {i}...");
|
||||||
|
|
||||||
Bitmap _mainImage;
|
Bitmap _mainImage;
|
||||||
if (templateName.StartsWith("binary_"))
|
if (templateName.StartsWith("binary_"))
|
||||||
{
|
{
|
||||||
|
@ -398,7 +398,7 @@ public class ScreenMatch
|
||||||
|
|
||||||
results.Add(new ScreenMatchResult
|
results.Add(new ScreenMatchResult
|
||||||
{
|
{
|
||||||
FileName = image.Tag.ToString(),
|
FileName = templateName,
|
||||||
ScreenNumber = i,
|
ScreenNumber = i,
|
||||||
Position = matchPosition,
|
Position = matchPosition,
|
||||||
Text = text
|
Text = text
|
||||||
|
@ -559,19 +559,36 @@ public class ScreenMatch
|
||||||
if (windowImage != null)
|
if (windowImage != null)
|
||||||
{
|
{
|
||||||
Bitmap image = templateImages[templateCurrentIndex];
|
Bitmap image = templateImages[templateCurrentIndex];
|
||||||
|
string templateName = image.Tag as string;
|
||||||
|
Size templateSize = new Size
|
||||||
|
{
|
||||||
|
Width = image.Width,
|
||||||
|
Height = image.Height
|
||||||
|
};
|
||||||
|
|
||||||
List<Point> matchPositions = FindTemplate(windowImage, image);
|
List<Point> matchPositions = FindTemplate(windowImage, image);
|
||||||
matchPositions.ForEach((matchPosition) =>
|
matchPositions.ForEach((matchPosition) =>
|
||||||
{
|
{
|
||||||
string templateName = image.Tag as string;
|
try
|
||||||
results.Add(new ScreenMatchResult
|
|
||||||
{
|
{
|
||||||
FileName = templateName,
|
string text = sampleAny.Contains(templateName) ?
|
||||||
WindowHandle = hWnd,
|
InspectSample((Bitmap)windowImage.Clone(), matchPosition, templateSize, templateName, sampleSize) : string.Empty;
|
||||||
WindowTitle = windowTitle,
|
|
||||||
ProcessName = processName,
|
results.Add(new ScreenMatchResult
|
||||||
WindowPosition = windowPosition,
|
{
|
||||||
Position = matchPosition
|
FileName = templateName,
|
||||||
});
|
WindowHandle = hWnd,
|
||||||
|
WindowTitle = windowTitle,
|
||||||
|
ProcessName = processName,
|
||||||
|
WindowPosition = windowPosition,
|
||||||
|
Position = matchPosition,
|
||||||
|
Text = text
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
parent.Log($"Ignore the match. {ex.Message}");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user