Exemplo n.º 1
0
        private static CachingXDocument?TryGetXmlDocsDocument(AssemblyName assemblyName, string?pathToXmlFile)
        {
            if (Cache.TryGetValue(assemblyName.FullName, out var document))
            {
                return(document);
            }

            if (pathToXmlFile is null)
            {
                return(null);
            }

            if (DynamicApis.FileExists(pathToXmlFile) == false)
            {
                Cache[assemblyName.FullName] = null;
                return(null);
            }

            document = new CachingXDocument(pathToXmlFile);
            Cache[assemblyName.FullName] = document;

            return(document);
        }
Exemplo n.º 2
0
        private static XElement?GetXmlDocsElement(this ParameterInfo parameter, CachingXDocument xml)
        {
            var name    = GetMemberElementName(parameter.Member);
            var element = xml.GetXmlDocsElement(name);

            if (element != null)
            {
                ReplaceInheritdocElements(parameter.Member, element);

                IEnumerable result;
                if (parameter.IsRetval || string.IsNullOrEmpty(parameter.Name))
                {
                    result = element.Elements("returns");
                }
                else
                {
                    result = element.Elements("param").Where(x => x.Attribute("name")?.Value == parameter.Name);
                }

                return(result.OfType <XElement>().FirstOrDefault());
            }

            return(null);
        }
Exemplo n.º 3
0
 internal static XElement?GetXmlDocsElement(this XDocument xml, string name)
 {
     return(CachingXDocument.GetXmlDocsElement(xml, name));
 }
Exemplo n.º 4
0
        private static XElement?GetXmlDocsElement(this MemberInfo member, CachingXDocument xml)
        {
            var name = GetMemberElementName(member);

            return(xml.GetXmlDocsElement(name));
        }
Exemplo n.º 5
0
        internal static XElement?GetXmlDocsElement(this XDocument xml, string name)
        {
            var result = (IEnumerable)DynamicApis.XPathEvaluate(xml, $"/doc/members/member[@name='{name}']");

            return(CachingXDocument.GetXmlDocsElement(xml, name));
        }