Esempio n. 1
0
        public IDLXML(TextReader idlFile)
            : base(XElement.Load(idlFile))
        {
            Interfaces = from i in Elem.Elements("Interface") select new Interface(i);

            // Replace all typedefs with their actual type.
            foreach (var typedef in Elem.Elements("Typedef"))
            {
                foreach (var type in Elem.Descendants("Type"))
                {
                    if (type.Attribute("name") != null && type.Attribute("name").Value == typedef.Attribute("name").Value)
                    {
                        // Remove the old 'name' attribute.
                        type.SetAttributeValue("name", null);

                        // Copy over the 'name' and 'type' attributes from the typedef.
                        type.SetAttributeValue("name", (string)typedef.Element("Type").Attribute("name"));
                        type.SetAttributeValue("type", (string)typedef.Element("Type").Attribute("type"));
                    }
                }
            }
        }