Update ScreenMatch.cs
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled

This commit is contained in:
Namhyeon Go 2024-10-15 05:22:07 +09:00
parent e1d4df74b9
commit feb85625c5

View File

@ -465,16 +465,33 @@ public class ScreenMatch
// If the index value is negative, retrieve and use an outdated image from the queue
if (nextTemplateInfo.Index < 0)
{
// Dequeue the oldest image from the sampleOutdated queue
parent.Log($"Review and find the last data of {nextTemplateInfo.FileName}...");
Bitmap outdatedImage = null;
while (outdatedSamples.Count > 0)
// Dequeue the oldest image from the sampleOutdated queue
try
{
outdatedImage = outdatedSamples.Dequeue();
if (outdatedImage.Tag != null && ((SampleInfo)outdatedImage.Tag).FileName == nextTemplateInfo.FileName)
while (outdatedSamples.Count > 0)
{
break;
outdatedImage = outdatedSamples.Dequeue();
if (outdatedImage.Tag != null)
{
parent.Log($"Reviewing... {((SampleInfo)outdatedImage.Tag).FileName}");
if (((SampleInfo)outdatedImage.Tag).FileName == nextTemplateInfo.FileName)
{
parent.Log($"Found the last data of {nextTemplateInfo.FileName}");
break;
}
}
}
}
catch (Exception ex)
{
parent.Log($"Error while reviewing the data: {ex.Message}");
}
// Find the matching positions of the outdated image in the main image
if (outdatedImage != null) {