private NonLeafNode BackToRoot(NonLeafNode node) { if (node.Parent == null) { return node; } return BackToRoot(node.Parent); }
/// <summary> /// If the desired node is in children /// </summary> private bool SearchInChildren(NonLeafNode root, string name) { Node[] children = root.Children; int l = children.Length; for (byte i = 0; i < l; i++) { if (children[i] is NonLeafNode) { return SearchInChildren(children[i] as NonLeafNode, name); } else if (children[i].NodeName == name) { if (root is CompositeNode) { (root as CompositeNode).CurrentChildIndex = i; return true; } return false; } } return false; }