コード例 #1
0
        public static IEnumerable <string> GetSearchTags(this FunctionDescriptor member)
        {
            XDocument xml = null;

            if (member.Assembly != null)
            {
                xml = DocumentationServices.GetForAssembly(member.Assembly);
            }

            return(member.GetSearchTags(xml));
        }
コード例 #2
0
        public static string GetDescription(this TypedParameter member)
        {
            XDocument xml = null;

            if (member.Function != null && member.Function.Assembly != null)
            {
                xml = DocumentationServices.GetForAssembly(member.Function.Assembly);
            }

            return(member.GetDescription(xml));
        }
コード例 #3
0
        public static string GetSummary(this FunctionDescriptor member)
        {
            XDocument xml = null;

            if (member.Assembly != null)
            {
                xml = DocumentationServices.GetForAssembly(member.Assembly);
            }

            return(member.GetSummary(xml));
        }
コード例 #4
0
        private static MemberDocumentNode GetMemberDocumentNode(
            FunctionDescriptor function,
            XmlReader xml)
        {
            //customNodeDefinitions typedParameters don't have functionDescriptors
            if (function == null)
            {
                return(null);
            }
            var assemblyName = function.Assembly;

            if (string.IsNullOrEmpty(assemblyName))
            {
                return(null);
            }

            var fullyQualifiedName = MemberDocumentNode.MakeFullyQualifiedName
                                         (assemblyName, GetMemberElementName(function));

            if (!documentNodes.ContainsKey(fullyQualifiedName))
            {
                if (xml == null)
                {
                    xml = DocumentationServices.GetForAssembly(function.Assembly, function.PathManager);
                }
                LoadDataFromXml(xml, assemblyName);
            }

            MemberDocumentNode documentNode = null;

            if (documentNodes.ContainsKey(fullyQualifiedName))
            {
                documentNode = documentNodes[fullyQualifiedName];
            }
            else
            {
                var overloadedName = documentNodes.Keys.
                                     Where(key => key.Contains(function.ClassName + "." + function.FunctionName)).FirstOrDefault();

                if (overloadedName == null)
                {
                    return(null);
                }
                if (documentNodes.ContainsKey(overloadedName))
                {
                    documentNode = documentNodes[overloadedName];
                }
            }

            return(documentNode);
        }
コード例 #5
0
        private static string GetMemberElement(
            FunctionDescriptor function,
            XmlReader xml,
            DocumentElementType property,
            string paramName = "")
        {
            var assemblyName = function.Assembly;

            if (string.IsNullOrEmpty(assemblyName) || (function.Type == FunctionType.GenericFunction))
            {
                return(String.Empty); // Operators, or generic global function in DS script.
            }
            var fullyQualifiedName = MemberDocumentNode.MakeFullyQualifiedName
                                         (assemblyName, GetMemberElementName(function));

            if (!documentNodes.ContainsKey(fullyQualifiedName))
            {
                if (xml == null)
                {
                    xml = DocumentationServices.GetForAssembly(function.Assembly, function.PathManager);
                }
                LoadDataFromXml(xml, assemblyName);
            }

            MemberDocumentNode documentNode = null;

            if (documentNodes.ContainsKey(fullyQualifiedName))
            {
                documentNode = documentNodes[fullyQualifiedName];
            }
            else
            {
                var overloadedName = documentNodes.Keys.
                                     Where(key => key.Contains(function.ClassName + "." + function.FunctionName)).FirstOrDefault();

                if (overloadedName == null)
                {
                    return(String.Empty);
                }
                if (documentNodes.ContainsKey(overloadedName))
                {
                    documentNode = documentNodes[overloadedName];
                }
            }

            if (documentNode == null)
            {
                return(String.Empty);
            }
            if (property.Equals(DocumentElementType.Description) && !documentNode.Parameters.ContainsKey(paramName))
            {
                return(String.Empty);
            }

            switch (property)
            {
            case DocumentElementType.Summary:
                return(documentNode.Summary);

            case DocumentElementType.Description:
                return(documentNode.Parameters[paramName]);

            case DocumentElementType.SearchTags:
                return(documentNode.SearchTags);

            default:
                throw new ArgumentException("property");
            }
        }