public bool TryAnalysisReslut() { // 还没发送 if (!IsSent) { return(false); } if ((DateTime.Now - SendTime).TotalMilliseconds > (Timeout != 0 ? Timeout : 3000)) { if (CmdActions.ContainsKey(CmdKey)) { ReadTime = DateTime.Now; Log.debug("告知" + CmdKey + "处理函数超时!"); CmdActions[CmdKey](this); } return(true); } // 正确获得结果 if (ResultString.StartsWith("TS->")) { ResultStringList.Add(ResultString); Log.shell(ResultString.Replace("\r", "")); ResultByte.Clear(); IsRead = true; if (CmdActions.ContainsKey(CmdKey)) { Log.debug("执行" + CmdKey + "的结果分析"); CmdActions[CmdKey](this); } return(true); } return(false); }
/// <summary> /// Check if command is apart of this executor's dictionary. /// </summary> public bool IsCommand(string command) { if (CmdActions.ContainsKey(command)) { return(true); } return(false); }