private static string GetMemberElement(
            FunctionDescriptor function,
            XmlReader xml,
            DocumentElementType property,
            string paramName = "")
        {
            var documentNode = GetMemberDocumentNode(function, xml);

            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);

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

            default:
                throw new ArgumentException("property");
            }
        }
        private static string GetMemberElement(
            FunctionDescriptor function,
            XmlReader xml,
            DocumentElementType property,
            string paramName = "")
        {
            //customNodeDefinitions typedParameters don't have functionDescriptors
            if (function == null)
            {
                return string.Empty;
            }
            var assemblyName = function.Assembly;

            if (string.IsNullOrEmpty(assemblyName))
                return String.Empty;

            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");
            }
        }
Example #3
0
 public TableElement(int nestingLevel, DocumentElementType type, int row, int rowspan, int col, int colspan)
     : base(nestingLevel, type)
 {
     Row     = row;
     RowSpan = rowspan;
     Col     = col;
     ColSpan = colspan;
 }
Example #4
0
 public static BranchNode GetEmptyNode(DocumentElementType type, IDateService dateService,
                                       ObjectId creatorID, string nodeName, string comment)
 {
     return(new BranchNode()
     {
         BranchNodeID = ObjectId.GenerateNewId(),
         Comment = comment,
         CreatedAt = dateService.Now,
         UpdatedAt = dateService.Now,
         CreatorID = creatorID,
         DocumentElement = type switch
         {
             DocumentElementType.Image => new Image(),
             DocumentElementType.NumberedList => NumberedList.GetDefaultList(),
             DocumentElementType.Paragraph => new Paragraph(),
             DocumentElementType.Table => Table.GetDefaultTable(),
             _ => null
         },
Example #5
0
        public static Branch GetNewBranch(string branchName, IDateService dateService, DocumentElementType elementType,
                                          List <BranchAccess> accesses, ObjectId creatorID)
        {
            BranchNode firstNode = BranchNode.GetEmptyNode(elementType, dateService, creatorID, "New node", string.Empty);

            return(new Branch()
            {
                Accesses = accesses,
                Author = creatorID,
                BranchID = ObjectId.GenerateNewId(),
                BranchName = branchName,
                BranchNodes = new List <BranchNode>()
                {
                    firstNode
                },
                CreatedAt = dateService.Now,
                CurrentBranchNodeID = firstNode.BranchNodeID,
                UpdatedAt = dateService.Now,
            });
        }
        private static string GetMemberElement(
            FunctionDescriptor function,
            XmlReader xml,
            DocumentElementType property,
            string paramName = "")
        {
            var documentNode = GetMemberDocumentNode(function, xml);

            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");
            }
        }
Example #7
0
 public GroupElementWithTitle(int nestingLevel, DocumentElementType type, string title)
     : base(nestingLevel, type)
 {
     Title = title;
 }
Example #8
0
 public GroupElement(int nestingLevel, DocumentElementType type)
     : base(nestingLevel, type)
 {
     Elements = new List <DocumentElement>();
 }
Example #9
0
 public DocumentElement(int nestingLevel, DocumentElementType type)
 {
     NestingLevel = nestingLevel;
     Type         = type;
 }
Example #10
0
 public TableElement(int nestingLevel, DocumentElementType type, int row, int col)
     : this(nestingLevel, type, row, 1, col, 1)
 {
 }
        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");
            }
        }