public bool Execute() { int length = 19; if (Content.Length % length == 0) { int Count = Content.Length / length; string DeviceType; string CommandId; byte[] SubContent; for (int i = 0; i < Count; i++) { DeviceType = ConverUtil.ByteToStr_Q(Content, 7 + (length * i), 2); CommandId = Content[13 + (i * length)].ToString(); SubContent = ConverUtil.Byte_Q(Content, length * i, length); ICommand cmd; switch (DeviceType) { case "8016": switch (CommandId) { case "1": cmd = new DJJ_61443_8016_01(SubContent, StationId, PlatformTime); break; default: cmd = new IgnoreCommand(); break; } break; default: cmd = new IgnoreCommand(); break; } cmd.Execute(); } } else { MyLibrary.Log.Fatal(NAME + "长度出错;原始代码:" + MyLibrary.ConverUtil.ByteToHStr(Content)); } return(true); }
/// <summary> /// 56字节处理程序。 /// </summary> /// <param name="content"></param> private void Single_56(byte[] content) { Pro_ShipDevice_Card_New_Mod info = new Pro_ShipDevice_Card_New_Mod(); info.Pi_DevId = StationId.ToString(); info.Pi_DevTime = ConverUtil.Time(content, 0); //设备时间 info.Pi_Name = Encoding.Default.GetString(ConverUtil.Byte_Q(content, 6, 30)).Replace("\0", ""); //姓名 info.Pi_SFZH = Encoding.ASCII.GetString(ConverUtil.Byte_Q(content, 36, 18)); //身份证好。 UInt16 ResultNum; string Reason; Pro_ShipDevice_Card_New_Dal.Exec(info, out ResultNum, out Reason); if (ResultNum != 0) { MyLibrary.Log.Debug(Name + "出错;" + Reason + " 原始代码:" + OriginalCode); } }
public bool Execute() { int length = 4; if (Content.Length % length == 0) { int Count = Content.Length / length; byte[] SubContent; for (int i = 0; i < Count; i++) { SubContent = ConverUtil.Byte_Q(Content, length * i, length); Single(SubContent); } } else { MyLibrary.Log.Fatal(NAME + "长度出错;原始代码:" + OriginalCode); } return(true); }
public bool Execute() { int length = 35; if (Content.Length % length == 0) { int Count = Content.Length / length; string DeviceType; string CommandId; byte[] SubContent; for (int i = 0; i < Count; i++) { DeviceType = ConverUtil.ByteToStr_Q(Content, 7 + (length * i), 2); CommandId = Content[13 + (i * length)].ToString(); SubContent = ConverUtil.Byte_Q(Content, length * i, length); ICommand cmd; switch (DeviceType) { case "0411": switch (CommandId) { case "1": cmd = new CZW_61506_0411_01(SubContent, StationId, PlatformTime); break; case "2": cmd = new CZW_61506_0411_02(SubContent, StationId, PlatformTime); break; case "3": cmd = new CZW_61506_0411_03(SubContent, StationId, PlatformTime); break; case "17": cmd = new CZW_61506_0411_17(SubContent, StationId, PlatformTime); break; case "19": cmd = new CZW_61506_0411_19(SubContent, StationId, PlatformTime); break; case "21": cmd = new CZW_61506_0411_21(SubContent, StationId, PlatformTime); break; //case "33": // cmd = new CZW_61506_0411_33(SubContent, StationId, PlatformTime); // break; case "35": cmd = new CZW_61506_0411_35(SubContent, StationId, PlatformTime); break; case "37": cmd = new CZW_61506_0411_37(SubContent, StationId, PlatformTime); break; case "51": cmd = new CZW_61506_0411_51(SubContent, StationId, PlatformTime); break; case "53": cmd = new CZW_61506_0411_53(SubContent, StationId, PlatformTime); break; case "67": cmd = new CZW_61506_0411_67(SubContent, StationId, PlatformTime); break; case "69": cmd = new CZW_61506_0411_69(SubContent, StationId, PlatformTime); break; case "177": cmd = new CZW_61506_0411_177(SubContent, StationId, PlatformTime); break; case "195": cmd = new CZW_61506_0411_195(SubContent, StationId, PlatformTime); break; case "197": cmd = new CZW_61506_0411_197(SubContent, StationId, PlatformTime); break; case "199": cmd = new CZW_61506_0411_199(SubContent, StationId, PlatformTime); break; case "201": cmd = new CZW_61506_0411_201(SubContent, StationId, PlatformTime); break; default: cmd = new IgnoreCommand(); break; } break; case "0426": switch (CommandId) { case "1": cmd = new CZW_61506_0426_01(SubContent, StationId, PlatformTime); break; case "2": cmd = new CZW_61506_0426_02(SubContent, StationId, PlatformTime); break; case "3": cmd = new CZW_61506_0426_03(SubContent, StationId, PlatformTime); break; case "4": cmd = new CZW_61506_0426_04(SubContent, StationId, PlatformTime); break; default: cmd = new IgnoreCommand(); break; } break; default: cmd = new IgnoreCommand(); break; } cmd.Execute(); } } else { MyLibrary.Log.Fatal(Name + "长度出错;原始代码:" + MyLibrary.ConverUtil.ByteToHStr(Content)); } return(true); }