示例#1
0
        public ParseState Parse(XmlElement element, ParseState parseState)
        {
            string name = element.Attributes["name"].InnerText;
            string docs = element.Attributes["docs"].InnerText;

            EngineStruct engineStruct = new EngineStruct(name)
            {
                Docs  = docs,
                Scope = parseState.Scope
            };

            foreach (XmlElement childNode in element.ChildNodes)
            {
                if (!childNode.Name.Equals("fields"))
                {
                    continue;
                }
                foreach (XmlElement fieldNode in childNode.ChildNodes)
                {
                    engineStruct.Add(new EngineStruct.Field()
                    {
                        Name        = fieldNode.Attributes["name"].InnerText,
                        TypeName    = fieldNode.Attributes["type"].InnerText,
                        Offset      = fieldNode.Attributes["offset"].InnerText,
                        Docs        = fieldNode.Attributes["docs"].InnerText,
                        IndexedSize = int.Parse(fieldNode.Attributes["indexedSize"].InnerText)
                    });
                }
            }

            parseState.Structs.Add(engineStruct);
            return(parseState);
        }