/// <summary> /// Tertiary constructor used for twin/duplicate XML Definitions within a file. /// </summary> /// <param name="xmlElement">The differing XML Element for this twin.</param> /// <param name="parentTree">he parent XML tree.</param> /// <param name="twinTree">The original XML tree.</param> private XmlCookedTree(XmlCookedElement xmlElement, XmlCookedTree parentTree, XmlCookedTree twinTree) { _element = xmlElement; Parent = parentTree; Definition = twinTree.Definition; _twinTree = twinTree; }
/// <summary> /// Secondary constructor used for child node types. /// </summary> /// <param name="xmlDefinition">The child tree XML Definition.</param> /// <param name="xmlElement">The XML Element type (should be of .ElementType = Table or TableCount).</param> /// <param name="parentTree">The parent XML tree.</param> /// <param name="elementCount">Count of elements in this definition in this XML File.</param> public XmlCookedTree(XmlCookedDefinition xmlDefinition, XmlCookedElement xmlElement, XmlCookedTree parentTree, int elementCount) { Definition = xmlDefinition; _element = xmlElement; Parent = parentTree; Count = elementCount; _elements = new Dictionary <uint, Branch>(); }
/// <summary> /// Secondary constructor used for child node types. /// </summary> /// <param name="xmlDefinition">The child tree XML Definition.</param> /// <param name="xmlElement">The XML Element type (should be of .ElementType = Table or TableCount).</param> /// <param name="parentTree">The parent XML tree.</param> /// <param name="elementCount">Count of elements in this definition in this XML File.</param> public XmlCookedTree(XmlCookedDefinition xmlDefinition, XmlCookedElement xmlElement, XmlCookedTree parentTree, int elementCount) { Definition = xmlDefinition; _element = xmlElement; Parent = parentTree; Count = elementCount; _elements = new Dictionary<uint, Branch>(); }
/// <summary> /// Replaces last added element with tree. Automatically links the XML Element to tree. /// </summary> /// <param name="definitionHash">The element name hash of the existing tree.</param> public void AddExistingTree(UInt32 definitionHash) { XmlCookedTree tree = _GetExistingTree(Root, definitionHash); Debug.Assert(tree != null, "AddExistingTree: tree not found!"); tree = tree.TwinRoot; Debug.Assert(tree != null, "AddExistingTree: tree not found!"); XmlCookedElement xmlElement = _elements.Last().Value.Element; XmlCookedTree newTree = new XmlCookedTree(xmlElement, this, tree); AddTree(newTree); }
/// <summary> /// Add an element to the tree. /// </summary> /// <param name="xmlElement">The XML Element to add to the tree.</param> public void AddElement(XmlCookedElement xmlElement) { _elements.Add(xmlElement.NameHash, new Branch(xmlElement)); }
public Branch(XmlCookedElement element, XmlCookedTree tree = null) { Element = element; Tree = tree; }
public Branch(XmlCookedElement element, XmlCookedTree tree=null) { Element = element; Tree = tree; }