Commit 941dda78 几米阳光

国际化日志增加开关

1 个父辈 f2f4dc53
...@@ -14,7 +14,7 @@ namespace CodeLibrary ...@@ -14,7 +14,7 @@ namespace CodeLibrary
//public delegate string GetStringDelegate(string id, string defaultStr, params object[] param); //public delegate string GetStringDelegate(string id, string defaultStr, params object[] param);
//public static event GetStringDelegate GetStringEvent; //public static event GetStringDelegate GetStringEvent;
public static bool OpenResourceLog = false;
public static string China = "zh-CN"; public static string China = "zh-CN";
public static string English = "en-US"; public static string English = "en-US";
private static Dictionary<string, string> chineseMap = new Dictionary<string, string>(); private static Dictionary<string, string> chineseMap = new Dictionary<string, string>();
...@@ -95,9 +95,10 @@ namespace CodeLibrary ...@@ -95,9 +95,10 @@ namespace CodeLibrary
private static void NoIdLog(string id, string defaultStr) private static void NoIdLog(string id, string defaultStr)
{ {
if (OpenResourceLog)
HDLogUtil.info("No id:[" + id + "], please add,use default string :" + defaultStr); {
HDLogUtil.info("No id:[" + id + "], please add,use default string :" + defaultStr);
}
} }
static CodeResourceControl() static CodeResourceControl()
{ {
......
...@@ -21,26 +21,26 @@ namespace CodeLibrary ...@@ -21,26 +21,26 @@ namespace CodeLibrary
/// </summary> /// </summary>
public static HWindow HalconWindow = null; public static HWindow HalconWindow = null;
///// <summary> /// <summary>
///// 根据图片路径解析二维码 /// 根据图片路径解析二维码
///// </summary> /// </summary>
///// <param name="filePath">图片路径</param> /// <param name="filePath">图片路径</param>
///// <param name="codeCount">二维码数量</param> /// <param name="codeCount">二维码数量</param>
///// <param name="codeParamPath">二维码参数路径,""表示不使用参数</param> /// <param name="codeParamPath">二维码参数路径,""表示不使用参数</param>
///// <param name="paramType">二维码类型,不传类型默认Data Matrix ECC 200</param> /// <param name="paramType">二维码类型,不传类型默认Data Matrix ECC 200</param>
///// <returns>解析到的二维码</returns> /// <returns>解析到的二维码</returns>
//public static List<string> DecodeCode(string filePath, int codeCount, string codeParamPath, params string[] paramType) public static List<CodeInfo> DecodeCode(string filePath, int codeCount, string codeParamPath, params string[] paramType)
//{ {
// HObject ho_Image; HObject ho_Image;
// HOperatorSet.GenEmptyObj(out ho_Image); HOperatorSet.GenEmptyObj(out ho_Image);
// ho_Image.Dispose(); ho_Image.Dispose();
// HOperatorSet.ReadImage(out ho_Image, filePath); HOperatorSet.ReadImage(out ho_Image, filePath);
// if (HalconWindow != null) if (HalconWindow != null)
// { {
// HOperatorSet.DispObj(ho_Image, HalconWindow); HOperatorSet.DispObj(ho_Image, HalconWindow);
// } }
// return DecodeCode(ho_Image, codeCount,codeParamPath, paramType); return DecodeCode(ho_Image, codeCount, codeParamPath, paramType);
//} }
/// <summary> /// <summary>
/// 根据图片解析二维码 /// 根据图片解析二维码
/// </summary> /// </summary>
...@@ -118,9 +118,10 @@ namespace CodeLibrary ...@@ -118,9 +118,10 @@ namespace CodeLibrary
ShowImage(HalconWindow, ho_Image, ho_SymbolXLDs); ShowImage(HalconWindow, ho_Image, ho_SymbolXLDs);
} }
HOperatorSet.ClearDataCode2dModel(hv_DataCodeHandle); HOperatorSet.ClearDataCode2dModel(hv_DataCodeHandle);
string[] resultList = hv_DecodedDataStrings.SArr;
if (resultList.Length > 0) if (hv_DecodedDataStrings.Length > 0)
{ {
string[] resultList = hv_DecodedDataStrings.SArr;
for (int i = 0; i < hv_DecodedDataStrings.SArr.Length; i++) for (int i = 0; i < hv_DecodedDataStrings.SArr.Length; i++)
{ {
try try
...@@ -136,7 +137,7 @@ namespace CodeLibrary ...@@ -136,7 +137,7 @@ namespace CodeLibrary
HDLogUtil.error("处理二维码出错:索引=" + i + "," + resultList.ToString()); HDLogUtil.error("处理二维码出错:索引=" + i + "," + resultList.ToString());
} }
} }
} }
return codeList; return codeList;
} }
catch (Exception ex) catch (Exception ex)
...@@ -144,6 +145,7 @@ namespace CodeLibrary ...@@ -144,6 +145,7 @@ namespace CodeLibrary
HDLogUtil.error("DecodeCode出错:" + ex.ToString()); HDLogUtil.error("DecodeCode出错:" + ex.ToString());
return codeList; return codeList;
} }
} }
internal static void ShowImage(HWindow window, HObject ho_Image, HObject ho_SymbolXLDs) internal static void ShowImage(HWindow window, HObject ho_Image, HObject ho_SymbolXLDs)
{ {
...@@ -221,6 +223,14 @@ namespace CodeLibrary ...@@ -221,6 +223,14 @@ namespace CodeLibrary
string filePath = appPath + codeType + ".dcm"; string filePath = appPath + codeType + ".dcm";
return filePath; return filePath;
} }
public static List<CodeInfo> DecodeBarCode(string filePath)
{
HObject ho_Image;
HOperatorSet.GenEmptyObj(out ho_Image);
ho_Image.Dispose();
HOperatorSet.ReadImage(out ho_Image, filePath);
return DecodeBarCode(ho_Image);
}
public static List<CodeInfo> DecodeBarCode(Bitmap bitmap) public static List<CodeInfo> DecodeBarCode(Bitmap bitmap)
{ {
HObject ho_image = Bitmap2HObjectBpp24(bitmap); HObject ho_image = Bitmap2HObjectBpp24(bitmap);
...@@ -285,6 +295,7 @@ namespace CodeLibrary ...@@ -285,6 +295,7 @@ namespace CodeLibrary
} }
} }
HOperatorSet.ClearBarCodeModel(hv_BarCodeHandle); HOperatorSet.ClearBarCodeModel(hv_BarCodeHandle);
return codeList; return codeList;
} }
catch (Exception ex) catch (Exception ex)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!