Commit f85a0b3d 刘韬

1

1 个父辈 59dbae0f
......@@ -261,21 +261,28 @@ namespace SmartScan
// 读取文件内容
string fileContent = File.ReadAllText(FilePath.CONFIG_Code_Value);
List<string> lines = fileContent.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries).Select(s=>s.Trim()).ToList();
LogNet.log.Info("扫描到条码:"+string.Join(",", codeTexts));
LogNet.log.Info("在以下条码中匹配:"+fileContent);
// 检查文件内容是否包含任一条码文本
foreach (string codeText in codeTexts)
foreach (string ln in lines.ToArray())
{
if (fileContent.Contains(codeText))
foreach (string codeText in codeTexts)
{
LogNet.log.Info($"条码 {codeText} 在文件中找到匹配");
return true;
if (ln.Trim() == codeText.Trim())
{
LogNet.log.Info($"条码 {codeText} 在文件中找到匹配");
lines.Remove(ln);
}
}
}
LogNet.log.Info("所有条码在文件中均未找到匹配");
return false;
if (lines.Count > 0)
{
LogNet.log.Info("以下条码文件中均未找到匹配:" + string.Join(",", lines.ToArray()));
return false;
}
else
return true;
}
catch (Exception ex)
{
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!