Commit d3833fb6 刘韬

1

1 个父辈 34e983fe
......@@ -93,6 +93,7 @@ namespace ScanCodeServer
List<CodeInfo> codeList = new List<CodeInfo>();
try
{
//HOperatorSet.SetSystem("filename_encoding", "utf8");
HTuple hv_Area = null;
HTuple hv_Row1 = null;
HTuple hv_Column = null;
......@@ -114,7 +115,7 @@ namespace ScanCodeServer
//ho_SymbolXLDs.Dispose();
// set_data_code_2d_param(DataCodeHandle, 'timeout', 200)
HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "timeout", timeOut);
//HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "string_encoding", "raw");
//HOperatorSet.SetDataCode2dParam(hv_DataCodeHandle, "string_encoding", "locale");
if (codeCount <= 0)
{
HOperatorSet.FindDataCode2d(ho_Image, out ho_SymbolXLDs, hv_DataCodeHandle,
......@@ -144,6 +145,8 @@ namespace ScanCodeServer
int x = (int)Math.Round(hv_Column.DArr[i]);
int y = (int)Math.Round(hv_Row1.DArr[i]);
string str = hv_DecodedDataStrings.SArr[i];
//var isv = IsStringValid(str);
CodeInfo code = new CodeInfo(str, x, y);
codeList.Add(code);
}
......@@ -202,6 +205,16 @@ namespace ScanCodeServer
}
}
static bool IsStringValid(string str)
{
Encoding encoding = Encoding.GetEncoding("gb2312"); // 修改为你需要的编码方式
byte[] bytes = encoding.GetBytes(str);
string decodedStr = encoding.GetString(bytes);
bool isValid = (str == decodedStr);
return isValid;
}
internal static void ShowImage(HWindow window, HObject ho_Image, HObject ho_SymbolXLDs)
{
if (window == null || ho_Image == null)
......
......@@ -17,11 +17,8 @@ namespace ScanCodeServer
static void Main()
{
_ = new Mutex(true, Application.ProductName, out bool ret);
if (!ret)
{
return;
}
if (!ret)
return;
Config.LoadMyConfig(new Setting().GetType());
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!