/// <summary> /// 验证 /// </summary> /// <returns></returns> private bool Verify() { CheckHelper checkHelper = new CheckHelper(this.m_ResultConnection); //Init(); if (m_NormalRuleList == null) return false; if (m_TopoRuleList == null) return false; bool isSucceed = true; for (int i = 0; i < m_NormalRuleList.Count; i++) { try { SendVerifyingEvent(m_NormalRuleList[i]); if (!m_NormalRuleList[i].Verify()) { SendMessage(enumMessageType.VerifyError, string.Format("规则“{0}”验证失败\r\n", m_NormalRuleList[i].InstanceName)); m_NormalRuleList.RemoveAt(i); i--; isSucceed = false; } else { checkHelper.AddVerifiedRule(m_DictRuleAndInfo[m_NormalRuleList[i]],m_NormalRuleList[i].ErrorType, enumRuleState.ExecuteFailed); } } catch (Exception exp) { SendMessage(enumMessageType.Exception, exp.ToString()); SendMessage(enumMessageType.VerifyError, string.Format("规则“{0}”验证失败\r\n", m_NormalRuleList[i].InstanceName)); m_NormalRuleList.RemoveAt(i); i--; isSucceed = false; } } for (int i = 0; i < m_TopoRuleList.Count; i++) { try { SendVerifyingEvent(m_TopoRuleList[i]); if (!m_TopoRuleList[i].Verify()) { SendMessage(enumMessageType.VerifyError, string.Format("规则“{0}”验证失败\r\n", m_TopoRuleList[i].InstanceName)); m_TopoRuleList.RemoveAt(i); i--; isSucceed = false; } else { checkHelper.AddVerifiedRule(m_DictRuleAndInfo[m_TopoRuleList[i]],m_TopoRuleList[i].ErrorType, enumRuleState.ExecuteFailed); } } catch (Exception exp) { SendMessage(enumMessageType.Exception, exp.ToString()); SendMessage(enumMessageType.VerifyError, string.Format("规则“{0}”验证失败{1}\r\n", m_TopoRuleList[i].InstanceName,exp.Message)); m_TopoRuleList.RemoveAt(i); i--; isSucceed = false; } } if (this.VerifyedComplete != null) this.VerifyedComplete.Invoke(this,m_NormalRuleList.Count + m_TopoRuleList.Count); return isSucceed; }
/// <summary> /// 验证 /// </summary> /// <returns></returns> private bool Verify() { CheckHelper checkHelper = new CheckHelper(this.m_ResultConnection); //Init(); if (m_NormalRuleList == null) { return(false); } if (m_TopoRuleList == null) { return(false); } bool isSucceed = true; for (int i = 0; i < m_NormalRuleList.Count; i++) { try { SendVerifyingEvent(m_NormalRuleList[i]); if (!m_NormalRuleList[i].Verify()) { SendMessage(enumMessageType.VerifyError, string.Format("规则“{0}”验证失败\r\n", m_NormalRuleList[i].InstanceName)); m_NormalRuleList.RemoveAt(i); i--; isSucceed = false; } else { checkHelper.AddVerifiedRule(m_DictRuleAndInfo[m_NormalRuleList[i]], m_NormalRuleList[i].ErrorType, enumRuleState.ExecuteFailed); } } catch (Exception exp) { SendMessage(enumMessageType.Exception, exp.ToString()); SendMessage(enumMessageType.VerifyError, string.Format("规则“{0}”验证失败\r\n", m_NormalRuleList[i].InstanceName)); m_NormalRuleList.RemoveAt(i); i--; isSucceed = false; } } for (int i = 0; i < m_TopoRuleList.Count; i++) { try { SendVerifyingEvent(m_TopoRuleList[i]); if (!m_TopoRuleList[i].Verify()) { SendMessage(enumMessageType.VerifyError, string.Format("规则“{0}”验证失败\r\n", m_TopoRuleList[i].InstanceName)); m_TopoRuleList.RemoveAt(i); i--; isSucceed = false; } else { checkHelper.AddVerifiedRule(m_DictRuleAndInfo[m_TopoRuleList[i]], m_TopoRuleList[i].ErrorType, enumRuleState.ExecuteFailed); } } catch (Exception exp) { SendMessage(enumMessageType.Exception, exp.ToString()); SendMessage(enumMessageType.VerifyError, string.Format("规则“{0}”验证失败{1}\r\n", m_TopoRuleList[i].InstanceName, exp.Message)); m_TopoRuleList.RemoveAt(i); i--; isSucceed = false; } } if (this.VerifyedComplete != null) { this.VerifyedComplete.Invoke(this, m_NormalRuleList.Count + m_TopoRuleList.Count); } return(isSucceed); }