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];
|
||||
parent.Log($"Trying match the template {image.Tag as string} on the screen {i}...");
|
||||
|
||||
string templateName = image.Tag as string;
|
||||
Size templateSize = new Size
|
||||
{
|
||||
|
@ -378,6 +376,8 @@ public class ScreenMatch
|
|||
Height = image.Height
|
||||
};
|
||||
|
||||
parent.Log($"Trying match the template {templateName} on the screen {i}...");
|
||||
|
||||
Bitmap _mainImage;
|
||||
if (templateName.StartsWith("binary_"))
|
||||
{
|
||||
|
@ -398,7 +398,7 @@ public class ScreenMatch
|
|||
|
||||
results.Add(new ScreenMatchResult
|
||||
{
|
||||
FileName = image.Tag.ToString(),
|
||||
FileName = templateName,
|
||||
ScreenNumber = i,
|
||||
Position = matchPosition,
|
||||
Text = text
|
||||
|
@ -559,10 +559,21 @@ public class ScreenMatch
|
|||
if (windowImage != null)
|
||||
{
|
||||
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);
|
||||
matchPositions.ForEach((matchPosition) =>
|
||||
{
|
||||
string templateName = image.Tag as string;
|
||||
try
|
||||
{
|
||||
string text = sampleAny.Contains(templateName) ?
|
||||
InspectSample((Bitmap)windowImage.Clone(), matchPosition, templateSize, templateName, sampleSize) : string.Empty;
|
||||
|
||||
results.Add(new ScreenMatchResult
|
||||
{
|
||||
FileName = templateName,
|
||||
|
@ -570,8 +581,14 @@ public class ScreenMatch
|
|||
WindowTitle = windowTitle,
|
||||
ProcessName = processName,
|
||||
WindowPosition = windowPosition,
|
||||
Position = matchPosition
|
||||
Position = matchPosition,
|
||||
Text = text
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
parent.Log($"Ignore the match. {ex.Message}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user