示例#1
0
        private static void Visit(XmlDocFile docFile, XmlNode document)
        {
            foreach (var item in document.ChildNodes)
            {
                if (item is XmlElement xmlElement)
                {
                    if (string.Equals(xmlElement.Name, "assembly", StringComparison.OrdinalIgnoreCase))
                    {
                        var asmName = xmlElement.ChildNodes.OfType <XmlNode>().FirstOrDefault(x => string.Equals(x.Name, "name", StringComparison.OrdinalIgnoreCase));
                        var text    = asmName?.InnerText;
                        if (!string.IsNullOrEmpty(text))
                        {
                            docFile.AssemblyName = text;
                        }
                        continue;
                    }

                    if (string.Equals(xmlElement.Name, "members", StringComparison.OrdinalIgnoreCase))
                    {
                        VisitMembers(docFile, xmlElement);
                        continue;
                    }

                    Visit(docFile, xmlElement);
                }
            }
        }
示例#2
0
        private static XmlDocFile ParseDocFile(string appPath)
        {
            var document = new XmlDocument();

            document.Load(appPath);

            var docFile = new XmlDocFile(document)
            {
                FilePath = appPath
            };

            Visit(docFile, document);
            return(docFile);
        }
示例#3
0
        private static void VisitMembers(XmlDocFile docFile, XmlElement xmlElement)
        {
            foreach (var childNode in xmlElement.ChildNodes.OfType <XmlElement>())
            {
                var memberName = childNode.GetAttributeValue("name");
                var summary    = childNode.ChildNodes.OfType <XmlElement>().FirstOrDefault(x => string.Equals(x.Name, "summary", StringComparison.OrdinalIgnoreCase));

                if (string.IsNullOrEmpty(memberName) || summary == null)
                {
                    continue;
                }

                docFile.Members.Add(memberName, new XmlDocMember
                {
                    Name        = memberName,
                    SummaryNode = summary,
                    MemberNode  = childNode,
                    ParentFile  = docFile
                });
            }
        }
 static bool TryGetCrefImpl(string crefValue, XmlDocFile docFile, out XmlDocMember member)
 {
     return(docFile.Members.TryGetValue(crefValue, out member));
 }