Exemplo n.º 1
0
        public StyleCollection loadStyleCollection()
        {
            StyleCollection collection = new StyleCollection();
            if (good)
            {
                XmlDocument xml = new XmlDocument();
                xml.Load(this.path);
                string name = "";
                List<string> input = new List<string>();
                string output = "";

                foreach (XmlNode node in xml.SelectNodes("styles/style"))
                {
                    if (node.Attributes.Count == 1 && node.Attributes[0].Name == "type")
                        name = node.Attributes[0].Value;

                    collection.addStyle(name);
                    foreach (XmlNode child in node.ChildNodes)
                    {
                        foreach (XmlNode child2 in child.ChildNodes)
                        {
                            if (child2.Name == "input")
                                input.Add(child2.InnerText);
                            else if (child2.Name == "output")
                                output = child2.InnerText;
                        }
                        collection.getStyle()[collection.getSize() - 1].addSubStyle(input, output);
                        input.Clear();
                    }

                }
            }

            return collection;
        }