static void ImportCondition( GroupNode parent, Condition condition ) {
if( condition is ConditionIntRange ) {
ConditionIntRange cond = (ConditionIntRange)condition;
ConditionNode newNode = new ConditionNode {
Field = cond.Field,
Value = cond.Value,
Op = cond.Comparison
};
parent.Nodes.Add( newNode );
} else if( condition is ConditionSet ) {
ConditionSet set = (ConditionSet)condition;
GroupNode newNode = new GroupNode();
if( set is ConditionAND ) {
newNode.Op = GroupNodeType.AND;
} else if( set is ConditionOR ) {
newNode.Op = GroupNodeType.OR;
} else if( set is ConditionNAND ) {
newNode.Op = GroupNodeType.NAND;
} else if( set is ConditionNOR ) {
newNode.Op = GroupNodeType.OR;
} else {
return;
}
foreach( Condition subCondition in set.Conditions ) {
ImportCondition( newNode, subCondition );
}
parent.Nodes.Add(newNode);
}
}