public CustomVariable(ConfigNode node)
        {
            name = node.GetValue("name");

            foreach (ConfigNode sourceVarNode in node.GetNodes("SOURCE_VARIABLE")) {
                SourceVariable sourceVar = new SourceVariable(sourceVarNode);

                sourceVariables.Add(sourceVar);
            }

            if(sourceVariables.Count == 0) {
                throw new ArgumentException("Did not find any SOURCE_VARIABLE nodes in RPM_CUSTOM_VARIABLE", name);
            }

            string oper = node.GetValue("operator");
            if (oper == Operator.NONE.ToString()) {
                op = Operator.NONE;
            } else if (oper == Operator.AND.ToString()) {
                op = Operator.AND;
            } else if (oper == Operator.OR.ToString()) {
                op = Operator.OR;
            } else if (oper == Operator.XOR.ToString()) {
                op = Operator.XOR;
            } else {
                throw new ArgumentException("Found an invalid operator type in RPM_CUSTOM_VARIABLE", oper);
            }
        }
示例#2
0
        public CustomVariable(ConfigNode node)
        {
            name = node.GetValue("name");

            foreach (ConfigNode sourceVarNode in node.GetNodes("SOURCE_VARIABLE"))
            {
                SourceVariable sourceVar = new SourceVariable(sourceVarNode);

                sourceVariables.Add(sourceVar);
            }

            if (sourceVariables.Count == 0)
            {
                throw new ArgumentException("Did not find any SOURCE_VARIABLE nodes in RPM_CUSTOM_VARIABLE", name);
            }

            string oper = node.GetValue("operator");

            if (oper == Operator.NONE.ToString())
            {
                op = Operator.NONE;
            }
            else if (oper == Operator.AND.ToString())
            {
                op = Operator.AND;
            }
            else if (oper == Operator.OR.ToString())
            {
                op = Operator.OR;
            }
            else if (oper == Operator.NAND.ToString())
            {
                op = Operator.NAND;
            }
            else if (oper == Operator.NOR.ToString())
            {
                op = Operator.NOR;
            }
            else if (oper == Operator.XOR.ToString())
            {
                op = Operator.XOR;
            }
            else
            {
                throw new ArgumentException("Found an invalid operator type in RPM_CUSTOM_VARIABLE", oper);
            }
        }