diff --git a/.idea/.idea.detect/.idea/avalonia.xml b/.idea/.idea.detect/.idea/avalonia.xml index 704590d..be56585 100644 --- a/.idea/.idea.detect/.idea/avalonia.xml +++ b/.idea/.idea.detect/.idea/avalonia.xml @@ -7,7 +7,10 @@ + + + diff --git a/detect.gui/Services/OCRService.cs b/detect.gui/Services/OCRService.cs index 4fd56ac..cdf1ab4 100644 --- a/detect.gui/Services/OCRService.cs +++ b/detect.gui/Services/OCRService.cs @@ -106,6 +106,36 @@ public class OCRService { try { + var w = "0"; + var h = "0"; + var type = ReplaceChars(resultList[item.Index + 1].Text); + if (string.IsNullOrWhiteSpace(type)) continue; + if (type.Contains('P', StringComparison.CurrentCultureIgnoreCase) && type.Contains('L', StringComparison.CurrentCultureIgnoreCase)) + { + type = type.Replace("P", string.Empty); + type = type.Replace("L", string.Empty); + if (type.Contains('-', StringComparison.CurrentCultureIgnoreCase)) + { + type = type.Split("-")[0]; + if (type.Contains('x', StringComparison.CurrentCultureIgnoreCase)) + { + w = type.Split("x")[1]; + h = type.Split("x")[0]; + } + else + { + w = type; + h = type; + } + } + else + continue; + } + else + { + w = type.Split("x")[1]; + h = type.Split("x")[0]; + } data.Add(new { code = ReplaceChars(resultList[item.Index].Text), @@ -113,8 +143,10 @@ public class OCRService x = ReplaceChars(resultList[item.Index + 2].Text), y = ReplaceChars(resultList[item.Index + 3].Text), center = ReplaceChars(resultList[item.Index + 4].Text), - w = ReplaceChars(resultList[item.Index + 1].Text).Split("x")[1], - h = ReplaceChars(resultList[item.Index + 1].Text).Split("x")[0], + w = w, + h = h, + // w = ReplaceChars(resultList[item.Index + 1].Text).Split("x")[1], + // h = ReplaceChars(resultList[item.Index + 1].Text).Split("x")[0], angle = ReplaceChars(resultList[item.Index + 5].Text), }); } diff --git a/detect.sln.DotSettings.user b/detect.sln.DotSettings.user index a5b2a09..b7371fa 100644 --- a/detect.sln.DotSettings.user +++ b/detect.sln.DotSettings.user @@ -41,6 +41,7 @@ ForceIncluded ForceIncluded ForceIncluded + ForceIncluded ForceIncluded ForceIncluded ForceIncluded \ No newline at end of file