static GlowRootElementCollection BuildGlowTree(Element local, GlowElement glow) { while (local.Type != ElementType.Root) { GlowElement glowParent; if (local.Type == ElementType.Parameter) { var param = new GlowParameter(local.Number); param.Children = new GlowElementCollection(GlowTags.Parameter.Children); param.Children.Insert(glow); glowParent = param; } else { var node = new GlowNode(local.Number); node.Children = new GlowElementCollection(GlowTags.Node.Children); node.Children.Insert(glow); glowParent = node; } glow = glowParent; local = local.Parent; } var root = GlowRootElementCollection.CreateRoot(); root.Insert(glow); return(root); }
static GlowRootElementCollection BuildQualified(Element local, GlowElement glow) { var qualified = null as GlowElement; if (local.Type != ElementType.Root) { var path = local.BuildPath(); if (local.Type == ElementType.Parameter) { var qparam = new GlowQualifiedParameter(path); qparam.Children = new GlowElementCollection(GlowTags.QualifiedParameter.Children); qparam.Children.Insert(glow); qualified = qparam; } else if (local.Type == ElementType.Node) { var qnode = new GlowQualifiedNode(path); qnode.Children = new GlowElementCollection(GlowTags.QualifiedNode.Children); qnode.Children.Insert(glow); qualified = qnode; } } else { qualified = glow; } if (qualified != null) { var root = GlowRootElementCollection.CreateRoot(); root.Insert(qualified); return(root); } return(null); }