public static Condition ParseNodeConditions(TreeNode Node)
{
if (Node.Tag == null)
return null;
if (Node.Tag is ConditionList)
{
ConditionList C = (ConditionList)Node.Tag;
List<Condition> Cs = C.GetConditions();
// If a Plus / Div list has 3rd param, add the node
if (Cs.Count == 3 && (C.Type == ConditionType.Plus || C.Type == ConditionType.Div))
Node.Nodes.Add(Cs[2].ToTree());
// Remove old conditions
C.Clear();
foreach (TreeNode Sub in Node.Nodes)
{
Condition SC = ParseNodeConditions(Sub);
if (SC == null)
continue;
C.Add(SC);
}
return C;
}
else
return (Node.Tag is ConditionValue) ? (ConditionValue) Node.Tag : (Condition)Node.Tag;
}