mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-14 13:41:05 +00:00
Update ScreenMatch.cs
This commit is contained in:
parent
0742f17f2a
commit
c0e42480e0
|
@ -15,7 +15,6 @@ using System.Windows.Forms;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Tesseract;
|
using Tesseract;
|
||||||
using WelsonJS.Service;
|
using WelsonJS.Service;
|
||||||
using System.Security.Cryptography;
|
|
||||||
|
|
||||||
public class ScreenMatch
|
public class ScreenMatch
|
||||||
{
|
{
|
||||||
|
@ -480,15 +479,16 @@ public class ScreenMatch
|
||||||
{
|
{
|
||||||
Bitmap croppedNodupBitmap = CropBitmap(bitmap, matchPosition, templateSize, sampleNodupSize);
|
Bitmap croppedNodupBitmap = CropBitmap(bitmap, matchPosition, templateSize, sampleNodupSize);
|
||||||
uint bitmapCrc32 = ComputeBitmapCrc32(croppedNodupBitmap);
|
uint bitmapCrc32 = ComputeBitmapCrc32(croppedNodupBitmap);
|
||||||
parent.Log($"bitmapCrc32: {bitmapCrc32}");
|
croppedNodupBitmap.Tag = bitmapCrc32;
|
||||||
bool bitmapExists = sampleOutdated.Any(x => ComputeBitmapCrc32(x) == bitmapCrc32);
|
|
||||||
|
bool bitmapExists = sampleOutdated.Any(x => (uint)x.Tag == bitmapCrc32);
|
||||||
if (bitmapExists)
|
if (bitmapExists)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException($"This may be a duplicate request. {templateName}");
|
throw new InvalidOperationException($"This may be a duplicate request. {templateName}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sampleOutdated.Enqueue((Bitmap)croppedNodupBitmap.Clone());
|
sampleOutdated.Enqueue(croppedNodupBitmap);
|
||||||
parent.Log($"Added to the image queue. {templateName}");
|
parent.Log($"Added to the image queue. {templateName}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user