diff --git a/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs b/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs index f68f757..8050aa3 100644 --- a/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs +++ b/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs @@ -13,8 +13,7 @@ namespace Modbus.Net /// /// 收到的报文信息 /// 收到的断包长度查询位置 - /// 除掉长度查询信息外其它报文的长度 - /// 注意:该长度不包含CRC校验 + /// 除掉长度查询信息外其它报文的长度 /// 切分后的报文信息 private static ICollection DuplicateMessages(byte[] receiveMessage, ICollection packageCountPositions, int otherCount) { @@ -51,8 +50,7 @@ namespace Modbus.Net /// 获取按照长度断包的函数 /// /// 断包长度的位置信息 - /// 除掉长度查询信息外其它报文的长度 - /// 注意:该长度不包含CRC校验 + /// 除掉长度查询信息外其它报文的长度 /// 断包函数 public static Func> GetDuplcateFunc(ICollection packageCountPositions, int otherCount) { diff --git a/Modbus.Net/Modbus.Net/Job/MachineJobScheduler.cs b/Modbus.Net/Modbus.Net/Job/MachineJobScheduler.cs index 52e7653..67a35cf 100644 --- a/Modbus.Net/Modbus.Net/Job/MachineJobScheduler.cs +++ b/Modbus.Net/Modbus.Net/Job/MachineJobScheduler.cs @@ -94,8 +94,12 @@ namespace Modbus.Net public async Task Query(string queryId = null, Func, Dictionary> QueryDataFunc = null) { - JobChainingJobListenerWithDataMap listener = _scheduler.ListenerManager.GetJobListener("Modbus.Net.DataQuery.Chain") as JobChainingJobListenerWithDataMap; - if (listener == null) + JobChainingJobListenerWithDataMap listener; + try + { + listener = _scheduler.ListenerManager.GetJobListener("Modbus.Net.DataQuery.Chain") as JobChainingJobListenerWithDataMap; + } + catch { listener = new JobChainingJobListenerWithDataMap("Modbus.Net.DataQuery.Chain", false); _scheduler.ListenerManager.AddJobListener(listener, GroupMatcher.GroupEquals("Modbus.Net.DataQuery.Group"));