public override bool Load(ConfigNode configNode) { // Load base class bool valid = base.Load(configNode); valid &= ConfigNodeUtil.ParseValue <string>(configNode, "basename", x => basename = x, this); int index = 0; foreach (ConfigNode child in ConfigNodeUtil.GetChildNodes(configNode, "CONDITION")) { DataNode childDataNode = new DataNode("CONDITION_" + index++, dataNode, this); try { ConfigNodeUtil.SetCurrentDataNode(childDataNode); UnlockBase.ConditionDetail cd = new UnlockBase.ConditionDetail(); valid &= ConfigNodeUtil.ParseValue <UnlockBase.ConditionDetail.Condition>(child, "condition", x => cd.condition = x, this); valid &= ConfigNodeUtil.ParseValue <string>(child, "parameter", x => cd.parameter = x, this, "", x => ValidateMandatoryParameter(x, cd.condition)); conditions.Add(cd); } finally { ConfigNodeUtil.SetCurrentDataNode(dataNode); } } valid &= ConfigNodeUtil.ValidateMandatoryChild(configNode, "CONDITION", this); return(valid); }
public override bool Load(ConfigNode configNode) { // Load base class bool valid = base.Load(configNode); valid &= ConfigNodeUtil.ParseValue<string>(configNode, "basename", x => basename = x, this); int index = 0; foreach (ConfigNode child in ConfigNodeUtil.GetChildNodes(configNode, "CONDITION")) { DataNode childDataNode = new DataNode("CONDITION_" + index++, dataNode, this); try { ConfigNodeUtil.SetCurrentDataNode(childDataNode); UnlockBase.ConditionDetail cd = new UnlockBase.ConditionDetail(); valid &= ConfigNodeUtil.ParseValue<UnlockBase.ConditionDetail.Condition>(child, "condition", x => cd.condition = x, this); valid &= ConfigNodeUtil.ParseValue<string>(child, "parameter", x => cd.parameter = x, this, "", x => ValidateMandatoryParameter(x, cd.condition)); conditions.Add(cd); } finally { ConfigNodeUtil.SetCurrentDataNode(dataNode); } } valid &= ConfigNodeUtil.ValidateMandatoryChild(configNode, "CONDITION", this); return valid; }