public virtual bool load(List <property_t> properties) { for (int i = 0; i < properties.Count; ++i) { property_t p = properties[i]; if (p.name == "Mode") { switch (p.value) { case "Condition": this.m_mode = TransitionMode.Condition; break; case "Success": this.m_mode = TransitionMode.Success; break; case "Failure": this.m_mode = TransitionMode.Failure; break; case "End": this.m_mode = TransitionMode.End; break; } } else if (p.name == "Opl") { if (StringUtils.IsValidString(p.value)) { int pParenthesis = p.value.IndexOf('('); if (pParenthesis == -1) { this.m_opl = AgentMeta.ParseProperty(p.value); } else { this.m_opl = AgentMeta.ParseMethod(p.value); } } } else if (p.name == "Opr1") { if (StringUtils.IsValidString(p.value)) { int pParenthesis = p.value.IndexOf('('); if (pParenthesis == -1) { this.m_opr1 = AgentMeta.ParseProperty(p.value); } else { this.m_opr1 = AgentMeta.ParseMethod(p.value); } } } else if (p.name == "Operator") { this.m_operator = OperationUtils.ParseOperatorType(p.value); } else if (p.name == "Opr2") { if (StringUtils.IsValidString(p.value)) { int pParenthesis = p.value.IndexOf('('); if (pParenthesis == -1) { this.m_opr2 = AgentMeta.ParseProperty(p.value); } else { this.m_opr2 = AgentMeta.ParseMethod(p.value); } } } } return(this.m_opl != null); }
public virtual bool load(List <property_t> properties) { for (int i = 0; i < properties.Count; ++i) { property_t p = properties[i]; if (p.name == "Opl") { if (StringUtils.IsValidString(p.value)) { int pParenthesis = p.value.IndexOf('('); if (pParenthesis == -1) { this.m_opl = AgentMeta.ParseProperty(p.value); } else { this.m_opl = AgentMeta.ParseMethod(p.value); } } } else if (p.name == "Opr1") { if (StringUtils.IsValidString(p.value)) { int pParenthesis = p.value.IndexOf('('); if (pParenthesis == -1) { this.m_opr1 = AgentMeta.ParseProperty(p.value); } else { this.m_opr1 = AgentMeta.ParseMethod(p.value); } } } else if (p.name == "Operator") { this.m_operator = OperationUtils.ParseOperatorType(p.value); } else if (p.name == "Opr2") { if (StringUtils.IsValidString(p.value)) { int pParenthesis = p.value.IndexOf('('); if (pParenthesis == -1) { this.m_opr2 = AgentMeta.ParseProperty(p.value); } else { this.m_opr2 = AgentMeta.ParseMethod(p.value); } } } } return(this.m_opl != null); }
public virtual bool load(List <property_t> properties) { string opr2TypeName = null; string comparatorName = null; for (int i = 0; i < properties.Count; ++i) { property_t p = properties[i]; if (p.name == "Mode") { switch (p.value) { case "Condition": this.m_mode = TransitionMode.Condition; break; case "Success": this.m_mode = TransitionMode.Success; break; case "Failure": this.m_mode = TransitionMode.Failure; break; case "End": this.m_mode = TransitionMode.End; break; } } else if (p.name == "Opl") { if (StringUtils.IsValidString(p.value)) { int pParenthesis = p.value.IndexOf('('); if (pParenthesis == -1) { string typeName = null; this.m_opl = Condition.LoadRight(p.value, ref typeName); } else { //method this.m_opl_m = Action.LoadMethod(p.value); } } } else if (p.name == "Opr1") { if (StringUtils.IsValidString(p.value)) { int pParenthesis = p.value.IndexOf('('); if (pParenthesis == -1) { string typeName = null; this.m_opr1 = Condition.LoadRight(p.value, ref typeName); } else { //method this.m_opr1_m = Action.LoadMethod(p.value); } } } else if (p.name == "Operator") { comparatorName = p.value; switch (p.value) { case "Invalid": this.m_operator = EOperatorType.E_INVALID; break; case "Assign": this.m_operator = EOperatorType.E_ASSIGN; break; case "Add": this.m_operator = EOperatorType.E_ADD; break; case "Sub": this.m_operator = EOperatorType.E_SUB; break; case "Mul": this.m_operator = EOperatorType.E_MUL; break; case "Div": this.m_operator = EOperatorType.E_DIV; break; case "Equal": this.m_operator = EOperatorType.E_EQUAL; break; case "NotEqual": this.m_operator = EOperatorType.E_NOTEQUAL; break; case "Greater": this.m_operator = EOperatorType.E_GREATER; break; case "Less": this.m_operator = EOperatorType.E_LESS; break; case "GreaterEqual": this.m_operator = EOperatorType.E_GREATEREQUAL; break; case "LessEqual": this.m_operator = EOperatorType.E_LESSEQUAL; break; } } else if (p.name == "Opr2") { if (StringUtils.IsValidString(p.value)) { int pParenthesis = p.value.IndexOf('('); if (pParenthesis == -1) { this.m_opr2 = Condition.LoadRight(p.value, ref opr2TypeName); } else { //method this.m_opr2_m = Action.LoadMethod(p.value); } } } else { //Debug.Check(0, "unrecognised property %s", p.name); } } // compare if (this.m_operator >= EOperatorType.E_EQUAL && this.m_operator <= EOperatorType.E_LESSEQUAL) { if (!string.IsNullOrEmpty(comparatorName) && (this.m_opl != null || this.m_opl_m != null) && (this.m_opr2 != null || this.m_opr2_m != null)) { this.m_comparator = Condition.Create(comparatorName, this.m_opl, this.m_opl_m, this.m_opr2, this.m_opr2_m); } } return(this.m_opl != null); }