Example #1
0
        private static void TestOthers(BuildDocumenter documenter,
                                       TestOptions options, ReferenceEngineSettings engineSettings)
        {
            if (tocType == CustomTocType.ReferenceRoot)
            {
                return;
            }

            //string libraryDir = Path.Combine(sampleDir, @"SampleTestLibraryCLR\");
            //string outputDir = Path.Combine(libraryDir, @"Output\");
            //string projectDoc = Path.Combine(outputDir, "Project.xml");

            string sourceFile =
                @"F:\SandcastleAssist\Main\Samples\HelpersSamples.sln";
            ReferenceVsNetSource vsSource = new ReferenceVsNetSource();
            ReferenceVsNetItem   vsItem   = new ReferenceVsNetItem(
                new BuildFilePath(sourceFile));

            //vsItem.XamlSyntax = false;
            vsItem.AddInclude("{41A48F1C-3E52-4995-B181-363EDBC02CA0}");
            vsSource.Add(vsItem);

            CommentContent comments = vsSource.Comments;
            CommentItem    projItem = new CommentItem("R:Project",
                                                      CommentItemType.Project);

            projItem.Value.Add(new CommentPart("Summary of the project",
                                               CommentPartType.Summary));
            comments.Add(projItem);
            CommentItem nsItem = new CommentItem("N:TestLibraryCLR",
                                                 CommentItemType.Namespace);

            nsItem.Value.Add(new CommentPart("Summary of the namespace",
                                             CommentPartType.Summary));
            comments.Add(nsItem);

            ReferenceGroup apiGroup = new ReferenceGroup(
                "Test CPP-CLR Library", Guid.NewGuid().ToString(), vsSource);

            apiGroup.RunningHeaderText = "Sandcastle Helpers: C++/CLR Library";

            apiGroup.VersionType = ReferenceVersionType.AssemblyAndFile;

            if (engineSettings.RootNamespaceContainer)
            {
                apiGroup.RootNamespaceTitle = "Testing C++/CLR Library";
            }

            //ReferenceContent apiContent = apiGroup.Content;
            //apiContent.FrameworkType = BuildFrameworkType.Framework20;

            //apiGroup.AddItem(projectDoc, null);
            //apiContent.AddItem(Path.Combine(outputDir, "SampleLibraryCLR.xml"),
            //    Path.Combine(outputDir, "SampleLibraryCLR.dll"));

            //apiContent.AddDependency(Path.Combine(outputDir, ""));

            documenter.AddGroup(apiGroup);
        }
Example #2
0
        public override ReferenceContent Create(BuildGroupContext groupContext)
        {
            BuildExceptions.NotNull(groupContext, "groupContext");

            BuildContext context = groupContext.Context;
            BuildLogger  logger  = null;

            if (context != null)
            {
                logger = context.Logger;
            }

            if (!this.IsInitialized)
            {
                throw new BuildException(String.Format(
                                             "The content source '{0}' is not yet initialized.", this.Title));
            }
            if (!this.IsValid)
            {
                if (logger != null)
                {
                    logger.WriteLine(String.Format(
                                         "The content group source '{0}' is invalid.", this.Title),
                                     BuildLoggerLevel.Warn);
                }

                return(null);
            }

            ReferenceContent content = new ReferenceContent(_sourcePath);

            content.Load();

            CommentContent sourceComments = this.Comments;

            if (_overrideComments == null)
            {
                // Provide other user-supplied information to the content...
                if (sourceComments != null && !sourceComments.IsEmpty)
                {
                    // Merge the comments, overriding any existing...
                    CommentContent importComments = content.Comments;
                    if (importComments == null || importComments.IsEmpty)
                    {
                        content.Comments = sourceComments;
                    }
                    else
                    {
                        for (int i = 0; i < sourceComments.Count; i++)
                        {
                            CommentItem sourceItem = sourceComments[i];
                            if (!sourceItem.IsEmpty)
                            {
                                importComments.Add(sourceItem);
                            }
                        }
                    }
                }
            }
            else if (_overrideComments.Value)
            {
                content.Comments = sourceComments;
            }

            HierarchicalTocContent hierarchicalToc = this.HierarchicalToc;

            if (_overrideHierarchicalToc == null)
            {
                if (hierarchicalToc != null && !hierarchicalToc.IsEmpty)
                {
                    content.HierarchicalToc = hierarchicalToc;
                }
            }
            else if (_overrideHierarchicalToc.Value)
            {
                content.HierarchicalToc = hierarchicalToc;
            }

            ReferenceRootFilter typeFilters      = this.TypeFilters;
            ReferenceRootFilter attributeFilters = this.AttributeFilters;

            if (_overrideFilters == null)
            {
                if (typeFilters != null && !typeFilters.IsEmpty)
                {
                    content.TypeFilters = typeFilters;
                }
                if (attributeFilters != null && !attributeFilters.IsEmpty)
                {
                    content.AttributeFilters = attributeFilters;
                }
            }
            else if (_overrideFilters.Value)
            {
                content.TypeFilters      = typeFilters;
                content.AttributeFilters = attributeFilters;
            }

            return(content);
        }