// // // // // $Revision: 1965 $ // using System; using System.Collections.Generic; using System.Xml; namespace ICSharpCode.Core { /// /// Description of Path. /// public class ExtensionPath { string name; AddIn addIn; List codons = new List(); public AddIn AddIn { get { return addIn; } } public string Name { get { return name; } } public List Codons { get { return codons; } } public ExtensionPath(string name, AddIn addIn) { this.addIn = addIn; this.name = name; } public static void SetUp(ExtensionPath extensionPath, XmlReader reader, string endElement) { Stack conditionStack = new Stack(); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.EndElement: if (reader.LocalName == "Condition" || reader.LocalName == "ComplexCondition") { conditionStack.Pop(); } else if (reader.LocalName == endElement) { return; } break; case XmlNodeType.Element: string elementName = reader.LocalName; if (elementName == "Condition") { conditionStack.Push(Condition.Read(reader)); } else if (elementName == "ComplexCondition") { conditionStack.Push(Condition.ReadComplexCondition(reader)); } else { Codon newCodon = new Codon(extensionPath.AddIn, elementName, Properties.ReadFromAttributes(reader), conditionStack.ToArray()); extensionPath.codons.Add(newCodon); if (!reader.IsEmptyElement) { ExtensionPath subPath = extensionPath.AddIn.GetExtensionPath(extensionPath.Name + "/" + newCodon.Id); //foreach (ICondition condition in extensionPath.conditionStack) { // subPath.conditionStack.Push(condition); //} SetUp(subPath, reader, elementName); //foreach (ICondition condition in extensionPath.conditionStack) { // subPath.conditionStack.Pop(); //} } } break; } } } } }