From feb85625c51ea9fd9504d3d42aad90e1caa6959d Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Tue, 15 Oct 2024 05:22:07 +0900 Subject: [PATCH] Update ScreenMatch.cs --- .../WelsonJS.Service/ScreenMatch.cs | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/WelsonJS.Toolkit/WelsonJS.Service/ScreenMatch.cs b/WelsonJS.Toolkit/WelsonJS.Service/ScreenMatch.cs index a4a8ca2..34dcc80 100644 --- a/WelsonJS.Toolkit/WelsonJS.Service/ScreenMatch.cs +++ b/WelsonJS.Toolkit/WelsonJS.Service/ScreenMatch.cs @@ -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) {