internal void InitConditions() { if (m_Conditions == null) { m_Conditions = new List <Condition[]>(); for (int i = 0; i < m_Raw.conditions.Count; i++) { Condition[] cdts = new Condition[m_Raw.conditions[i].Length]; for (int j = 0; j < cdts.Length; j++) { Condition cdt = Asm.CreateConditionInstance(m_Raw.conditions[i][j].classname); if (cdt != null) { cdt.Init(this, m_Raw.conditions[i][j]); cdts[j] = cdt; } } m_Conditions.Add(cdts); } } else { for (int i = 0; i < m_Conditions.Count; ++i) { for (int j = 0; j < m_Conditions[i].Length; ++j) { m_Conditions[i][j].Init(this, m_Raw.conditions[i][j]); } } } }
string CustomCondition(string param) { param = param.Trim(); if (string.IsNullOrEmpty(param)) { return("parameters needed"); } string[] ss = param.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries); string classname = ss[0]; ScenarioRTL.Condition cdt = ScenarioRTL.Asm.CreateConditionInstance(classname); ScenarioRTL.IO.StatementRaw raw = new ScenarioRTL.IO.StatementRaw(); if (cdt == null) { return("cannot create statement"); } raw.classname = classname; raw.order = 0; raw.parameters = new ScenarioRTL.IO.ParamRaw(ss.Length - 1); for (int i = 1; i < ss.Length; ++i) { string paramstr = ss[i]; string[] nv = paramstr.Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries); if (nv.Length == 2) { raw.parameters.Set(i - 1, nv[0], nv[1]); } else { raw.parameters.Set(i - 1, "null", "0"); } } cdt.Init(null, raw); bool?check = cdt.Check(); return("[" + classname + "] check result is " + check.ToString()); }