void InitCollections() { nodeTypes = new ExtensionNodeTypeCollection(this); nodeSets = new NodeSetIdCollection(); foreach (XmlNode n in Element.ChildNodes) { XmlElement nt = n as XmlElement; if (nt == null) { continue; } if (nt.LocalName == "ExtensionNode") { ExtensionNodeType etype = new ExtensionNodeType(nt); nodeTypes.Add(etype); } else if (nt.LocalName == "ExtensionNodeSet") { string id = nt.GetAttribute("id"); if (id.Length > 0) { nodeSets.Add(id); } else { missingNodeSetId = true; } } } }
void GetAllowedNodeTypes(Hashtable visitedSets, ExtensionNodeTypeCollection col) { if (Id.Length > 0) { if (visitedSets.Contains(Id)) { return; } visitedSets [Id] = Id; } // Gets all allowed node types, including those defined in node sets // It only works for descriptions generated from a registry foreach (ExtensionNodeType nt in NodeTypes) { col.Add(nt); } AddinDescription desc = ParentAddinDescription; if (desc == null || desc.OwnerDatabase == null) { return; } foreach (string[] ns in NodeSets.InternalList) { string startAddin = ns [1]; if (startAddin == null || startAddin.Length == 0) { startAddin = desc.AddinId; } ExtensionNodeSet nset = desc.OwnerDatabase.FindNodeSet(ParentAddinDescription.Domain, startAddin, ns[0]); if (nset != null) { nset.GetAllowedNodeTypes(visitedSets, col); } } }