private static void TestSharpScript(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\Development\Source\Tests\ScriptSample\samples\PhotoDemo\PhotoDemo.sln";
            ReferenceVsNetSource vsSource = new ReferenceVsNetSource();
            ReferenceVsNetItem   vsItem   = new ReferenceVsNetItem(
                new BuildFilePath(sourceFile));

            vsItem.XamlSyntax = false;
            vsItem.AddInclude("{5F2605F7-5F00-4756-AC61-1D83B0E541E4}");
            vsItem.AddInclude("{16B291CB-4AC1-41B9-943C-341FB528D7A1}");
            vsItem.AddInclude("{4D8373CD-6685-4288-A1FF-1E37319D60D4}");
            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 ScriptSharp Library", Guid.NewGuid().ToString(), vsSource);

            apiGroup.RunningHeaderText = "Sandcastle Helpers: ScriptSharp Library";

            apiGroup.VersionType = ReferenceVersionType.AssemblyAndFile;
            apiGroup.SyntaxType  = BuildSyntaxType.CSharp | BuildSyntaxType.JavaScript;

            if (engineSettings.RootNamespaceContainer)
            {
                apiGroup.RootNamespaceTitle = "Testing ScriptSharp 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);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        private static void TestSilverlight(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\Development\Source\Tests\SilverlightClassLibrary3\SilverlightClassLibrary3.sln";
            ReferenceVsNetSource vsSource = new ReferenceVsNetSource();
            ReferenceVsNetItem   vsItem   = new ReferenceVsNetItem(
                new BuildFilePath(sourceFile));

            vsItem.XamlSyntax = false;
            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 Silverlight 5 Library", Guid.NewGuid().ToString(), vsSource);

            apiGroup.RunningHeaderText = "Sandcastle Helpers: Silverlight 5";

            apiGroup.VersionType = ReferenceVersionType.AssemblyAndFile;

            if (engineSettings.RootNamespaceContainer)
            {
                apiGroup.RootNamespaceTitle = "Testing Silverlight 5";
            }

            //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, ""));

            apiGroup.ContentFile = new BuildFilePath(Path.Combine(workingDir,
                                                                  "Silverlight.Group" + BuildFileExts.ReferenceGroupExt));

            documenter.AddGroup(apiGroup);
        }
        public static void Create(BuildDocumenter documenter,
                                  TestOptions options)
        {
            if (!options.BuildReferences)
            {
                return;
            }

            BuildSettings settings = documenter.Settings;

            ReferenceEngineSettings engineSettings = settings.EngineSettings[
                BuildEngineType.Reference] as ReferenceEngineSettings;

            Debug.Assert(engineSettings != null);

            if (engineSettings == null)
            {
                return;
            }

            sampleDir     = options.SampleDir;
            workingDir    = options.WorkingDir;
            sandAssistDir = options.SandAssistDir;
            tocType       = options.TocType;

            // Decide which namespace layout: Flat or Hierarchical
            ReferencesTocType refTestType = ReferencesTocType.Hierarchical;

            // Decide whether to use namespace root container
            engineSettings.RootNamespaceContainer = true;
            if (refTestType == ReferencesTocType.Hierarchical)
            {
                ReferenceTocLayoutConfiguration tocLayout =
                    engineSettings.TocLayout;
                tocLayout.ContentsAfter = false;
                tocLayout.LayoutType    = ReferenceTocLayoutType.Hierarchical;
            }

            // For testing script sharp...
            TestSharpScript(documenter, options, engineSettings);

            // For testing portable class libraries...
            TestPortable(documenter, options, engineSettings);

            // For testing Silverlight 5 projects...
            TestSilverlight(documenter, options, engineSettings);

            // For testing ASP.NET MVC projects...
            TestOther(documenter, options, engineSettings);

            // For testing VS.NET projects...
            TestSolution(documenter, options, engineSettings);
        }
        private static void TestSolution(BuildDocumenter documenter,
                                         TestOptions options, ReferenceEngineSettings engineSettings)
        {
            if (tocType == CustomTocType.ReferenceRoot)
            {
                return;
            }

            string sourceFile =
                @"F:\SandcastleAssist\Main\Tests\SmartDeviceProjectCE\SmartDeviceProjectCE.csproj";
            ReferenceVsNetSource vsSource = new ReferenceVsNetSource();
            ReferenceVsNetItem   vsItem   = new ReferenceVsNetItem(
                new BuildFilePath(sourceFile));

            vsItem.XamlSyntax = false;
            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 Compact Framework Library", Guid.NewGuid().ToString(), vsSource);

            apiGroup.RunningHeaderText = "Sandcastle Helpers: Compact Framework";

            apiGroup.VersionType = ReferenceVersionType.AssemblyAndFile;

            if (engineSettings.RootNamespaceContainer)
            {
                apiGroup.RootNamespaceTitle = "Testing Compact Framework";
            }

            //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);
        }
Esempio n. 6
0
        private static void TestHierarchicalToc(BuildDocumenter documenter,
                                                TestOptions options, ReferenceEngineSettings engineSettings)
        {
            if (tocType == CustomTocType.ReferenceRoot)
            {
                return;
            }

            string libraryDir = Path.Combine(sampleDir, @"SampleHierarchicalToc\");

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

            ReferenceGroup apiGroup = new ReferenceGroup(
                "Test Hierarchical Toc References", TestGroupIds.TestTocLibGroupId);

            apiGroup.RunningHeaderText = "Sandcastle Helpers: Test Hierarchical Toc";
            apiGroup.RootTopicId       = "d36e744f-c053-4e94-9ac9-b1ee054d8de1";

            apiGroup.VersionType = ReferenceVersionType.AssemblyAndFile;

            if (engineSettings.RootNamespaceContainer)
            {
                apiGroup.RootNamespaceTitle = "HierarchicalToc Test References";
            }

            ReferenceContent apiContent = apiGroup.Content;

            apiGroup.ContentFile = new BuildFilePath(Path.Combine(workingDir,
                                                                  "HierarchicalToc" + BuildFileExts.ReferenceGroupExt));

            apiContent.ContentFile = new BuildFilePath(Path.Combine(workingDir,
                                                                    "HierarchicalToc" + BuildFileExts.ReferenceContentExt));

            apiContent.FrameworkType = BuildFrameworkType.Framework35;

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

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

            documenter.AddGroup(apiGroup);
        }
Esempio n. 7
0
        private static void TestOthers0(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");

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

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

            apiGroup.VersionType = ReferenceVersionType.AssemblyAndFile;

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

            ReferenceContent apiContent = apiGroup.Content;

            apiGroup.ContentFile = new BuildFilePath(Path.Combine(workingDir,
                                                                  "OtherReference" + BuildFileExts.ReferenceGroupExt));

            apiContent.ContentFile = new BuildFilePath(Path.Combine(workingDir,
                                                                    "OtherReference" + BuildFileExts.ReferenceContentExt));

            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);
        }
Esempio n. 8
0
        private bool ProcessTocVisitors(BuildContext context, BuildGroupContext groupContext)
        {
            // We need the list of the available configurations from the
            // reference settings...
            BuildSettings settings = context.Settings;

            Debug.Assert(settings != null,
                         "The settings is not associated with the context.");
            if (settings == null)
            {
                return(false);
            }
            BuildEngineSettingsList listSettings = settings.EngineSettings;

            Debug.Assert(listSettings != null,
                         "The settings does not include the engine settings.");
            if (listSettings == null || listSettings.Count == 0)
            {
                return(false);
            }
            _engineSettings = listSettings[BuildEngineType.Reference] as ReferenceEngineSettings;

            Debug.Assert(_engineSettings != null,
                         "The settings does not include the reference engine settings.");
            if (_engineSettings == null)
            {
                return(false);
            }

            string tocFilePath = Path.Combine(this.WorkingDirectory,
                                              groupContext["$TocFile"]);

            if (File.Exists(tocFilePath))
            {
                _listDocuments = new List <ReferenceDocument>();

                ReferenceDocument document = new ReferenceDocument(
                    tocFilePath, ReferenceDocumentType.TableOfContents);

                _listDocuments.Add(document);
            }

            if (_listDocuments == null || _listDocuments.Count == 0)
            {
                return(false);
            }

            // 1. Create all the reference visitors...
            this.PrepareVisitors(context);
            if (_dictVisitors == null || _dictVisitors.Count == 0)
            {
                return(true);
            }

            // 2. Initialize all the reference visitors...
            ICollection <ReferenceTocVisitor> listVisitors = _dictVisitors.Values;

            foreach (ReferenceTocVisitor visitor in listVisitors)
            {
                visitor.Initialize(context, _group);
            }

            // 3. Process the configurations...
            this.ProcessDocuments(context);

            // 4. Un-initialize all the reference visitors...
            foreach (ReferenceTocVisitor visitor in listVisitors)
            {
                visitor.Uninitialize();
            }

            return(true);
        }
Esempio n. 9
0
        private static void TestMain(BuildDocumenter documenter,
                                     TestOptions options, ReferenceEngineSettings engineSettings)
        {
            // Decide which version information to use...
            ReferenceVersionType versionType = ReferenceVersionType.Advanced;

            string libraryDir = Path.Combine(sampleDir, @"SampleLibrary\");

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

            ReferenceGroup apiGroup = new ReferenceGroup(
                "Test API References", TestGroupIds.TestLibGroupId);

            apiGroup.RunningHeaderText = "Sandcastle Helpers: Test API Reference";

            if (engineSettings != null && engineSettings.RootNamespaceContainer)
            {
                apiGroup.RootNamespaceTitle = "SampleLibrary Test References";
            }

            ReferenceContent apiContent = apiGroup.Content;

            apiContent.FrameworkType = BuildFrameworkType.Framework35;
            apiContent.AddItem(projectDoc, null);
            apiContent.AddItem(Path.Combine(outputDir, "TestLibrary.xml"),
                               Path.Combine(outputDir, "TestLibrary.dll"));

            apiGroup.AddSnippet(new CodeSnippetContent(Path.Combine(
                                                           libraryDir, "CodeSnippetSample.snippets")));

            string helpTestDir = Path.Combine(sampleDir, @"SampleTopics\");
            string mediaLinks  = Path.Combine(helpTestDir, "MediaContent.media");

            apiGroup.AddMedia(new MediaContent(mediaLinks,
                                               Path.Combine(helpTestDir, "Media")));

            // Create and add an API filter...
            ReferenceNamespaceFilter namespaceFilter =
                new ReferenceNamespaceFilter("TestLibrary", true);

            namespaceFilter.Add(new ReferenceTypeFilter("Point3D", false, false));

            apiContent.TypeFilters.Add(namespaceFilter);

            documenter.AddGroup(apiGroup);

            ReferenceVersionInfo versionInfo = null;

            if (versionType == ReferenceVersionType.Advanced)
            {
                libraryDir = Path.Combine(sampleDir, @"SampleLibraryVersion\");
                outputDir  = Path.Combine(libraryDir, @"Output\");

                apiContent = new ReferenceContent();
                apiContent.FrameworkType = BuildFrameworkType.Framework20;
                apiContent.AddItem(Path.Combine(outputDir, "TestLibrary.xml"),
                                   Path.Combine(outputDir, "TestLibrary.dll"));

                versionInfo = new ReferenceVersionInfo();
                versionInfo.PlatformFilters = true;
                //versionInfo.PlatformId = "netfw";
                versionInfo.PlatformTitle = ".NET Framework";
                //versionInfo.VersionId = "netfw20";
                versionInfo.VersionLabel = "2.0";

                ReferenceVersionSource source = new ReferenceVersionSource();
                //source.VersionId    = "netfw10";
                source.VersionLabel = "1.0";
                source.Content      = apiContent;

                versionInfo.AddSource(source);

                apiGroup.VersionType = versionType;
                apiGroup.VersionInfo = versionInfo;
            }

            if (versionType == ReferenceVersionType.Advanced &&
                versionInfo != null)
            {
                libraryDir = Path.Combine(sampleDir, @"SampleLibrarySilverlight\");
                outputDir  = Path.Combine(libraryDir, @"Output\");

                apiContent = new ReferenceContent();
                apiContent.FrameworkType = BuildFrameworkType.Silverlight40;
                apiContent.AddItem(Path.Combine(outputDir, "TestLibrary.xml"),
                                   Path.Combine(outputDir, "TestLibrary.dll"));

                ReferenceVersionRelated relatedVersion = new ReferenceVersionRelated();
                relatedVersion.PlatformId = "silverlight_mobile";
                //relatedVersion.PlatformTitle = "Silverlight for Windows Phone";

                ReferenceVersionSource source = new ReferenceVersionSource();
                source.VersionId = "silverlight_mobile_v1";
                //source.VersionLabel = "Windows Phone OS 7.0";
                source.Content = apiContent;

                relatedVersion.Add(source);

                versionInfo.AddRelated(relatedVersion);
            }
        }
Esempio n. 10
0
        private static void TestSilverlightWPF(BuildDocumenter documenter,
                                               TestOptions options, ReferenceEngineSettings engineSettings)
        {
            if (tocType == CustomTocType.ReferenceRoot)
            {
                return;
            }

            // Decide which Caliburn Micro library to include: Silverlight or WPF
            bool useSilverlight = true;

            string libraryDir = Path.Combine(sampleDir, @"SampleLibrary\");

            if (useSilverlight)
            {
                string outputDir = Path.Combine(libraryDir, @"Libraries\Caliburn.Micro\Silverlight\");
                //string projectDoc = Path.Combine(outputDir, "Project.xml");

                ReferenceGroup apiGroup = new ReferenceGroup(
                    "Test Silverlight 4", Guid.NewGuid().ToString());
                apiGroup.RunningHeaderText = "Sandcastle Helpers: Test Silverlight 4.0";
                //apiGroup.RootTopicId = "d36e744f-c053-4e94-9ac9-b1ee054d8de1";
                apiGroup.SyntaxType        |= BuildSyntaxType.Xaml;
                apiGroup.EnableXmlnsForXaml = true;

                if (engineSettings.RootNamespaceContainer)
                {
                    apiGroup.RootNamespaceTitle = "Caliburn Micro for Silverlight 4.0 v1.0 RTW";
                }

                ReferenceContent apiContent = apiGroup.Content;
                apiContent.FrameworkType = BuildFrameworkType.Silverlight40;

                //apiGroup.AddItem(projectDoc, null);
                //apiContent.AddItem(Path.Combine(outputDir, "Caliburn.Micro.xml"),
                //    Path.Combine(outputDir, "Caliburn.Micro.dll"));
                ReferenceItem refItem = new ReferenceItem(
                    Path.Combine(outputDir, "Caliburn.Micro.xml"),
                    Path.Combine(outputDir, "Caliburn.Micro.dll"));
                //refItem.XamlSyntax = true;
                apiContent.Add(refItem);

                //apiContent.AddDependency(Path.Combine(outputDir, "System.Windows.Interactivity.dll"));

                documenter.AddGroup(apiGroup);
            }
            else
            {
                string outputDir = Path.Combine(libraryDir, @"Libraries\Caliburn.Micro\WPF\");
                //string projectDoc = Path.Combine(outputDir, "Project.xml");

                ReferenceGroup apiGroup = new ReferenceGroup(
                    "Test WPF .NET 4", Guid.NewGuid().ToString());
                apiGroup.RunningHeaderText = "Sandcastle Helpers: Test .NET Framework 4.0";
                //apiGroup.RootTopicId = "d36e744f-c053-4e94-9ac9-b1ee054d8de1";
                apiGroup.SyntaxType        |= BuildSyntaxType.Xaml;
                apiGroup.EnableXmlnsForXaml = true;

                if (engineSettings.RootNamespaceContainer)
                {
                    apiGroup.RootNamespaceTitle = "Caliburn Micro for WPF 4.0 v1.0 RTW";
                }

                ReferenceContent apiContent = apiGroup.Content;
                apiContent.FrameworkType = BuildFrameworkType.Framework40;

                //apiGroup.AddItem(projectDoc, null);
                //apiContent.AddItem(Path.Combine(outputDir, "Caliburn.Micro.xml"),
                //    Path.Combine(outputDir, "Caliburn.Micro.dll"));
                ReferenceItem refItem = new ReferenceItem(
                    Path.Combine(outputDir, "Caliburn.Micro.xml"),
                    Path.Combine(outputDir, "Caliburn.Micro.dll"));
                //refItem.XamlSyntax = true;
                apiContent.Add(refItem);

                //apiContent.AddDependency(Path.Combine(outputDir, "System.Windows.Interactivity.dll"));

                documenter.AddGroup(apiGroup);
            }
        }
Esempio n. 11
0
        private static void TestRedirection(BuildDocumenter documenter,
                                            TestOptions options, ReferenceEngineSettings engineSettings)
        {
            if (tocType == CustomTocType.ReferenceRoot)
            {
                return;
            }

            string libraryDir = Path.Combine(sampleDir, @"SampleLibrary\Libraries\");

            string outputDir  = Path.Combine(libraryDir, @"Redirects\");
            string projectDoc = Path.Combine(outputDir, "Project.xml");

            ReferenceGroup apiGroup = new ReferenceGroup(
                "Testing Redirection", Guid.NewGuid().ToString());

            apiGroup.RunningHeaderText = "Sandcastle Helpers: Testing Assembly Redirection";

            apiGroup.SyntaxType        |= BuildSyntaxType.Xaml;
            apiGroup.EnableXmlnsForXaml = true;
            apiGroup.VersionType        = ReferenceVersionType.Assembly;

            if (engineSettings.RootNamespaceContainer)
            {
                apiGroup.RootNamespaceTitle = "Testing Assembly Redirection";
            }

            ReferenceContent apiContent = apiGroup.Content;

            apiContent.FrameworkType = BuildFrameworkType.Framework40;

            apiContent.AddItem(projectDoc, null);
            ReferenceItem refItem = new ReferenceItem(
                Path.Combine(outputDir, "Tests.Drawings.xml"),
                Path.Combine(outputDir, "Tests.Drawings.dll"));

            //refItem.XamlSyntax = true;
            apiContent.Add(refItem);

            //apiContent.AddDependency(Path.Combine(outputDir, "Tests.Shapes.dll"));
            //apiContent.AddDependency(Path.Combine(outputDir, "Tests.Geometries.dll"));

            documenter.AddGroup(apiGroup);

            // Testing embedded documents...
            //apiGroup = new ReferenceGroup(
            //    "Testing Embeddeding", Guid.NewGuid().ToString());
            //apiGroup.ExcludeToc = true; //NOTE!!!
            //apiGroup.RunningHeaderText = "Sandcastle Helpers: Testing Assembly Redirection";

            //apiGroup.SyntaxType |= BuildSyntaxType.Xaml;
            //apiGroup.EnableXmlnsForXaml = true;
            //apiGroup.VersionType = ReferenceVersionType.Assembly;

            //if (engineSettings.RootNamespaceContainer)
            //{
            //    apiGroup.RootNamespaceTitle = "Testing Assembly Redirection";
            //}

            //apiContent = apiGroup.Content;
            //apiContent.FrameworkType = BuildFrameworkType.Framework40;
            //apiContent.AddItem(projectDoc, null);

            //apiContent.AddItem(projectDoc, null);
            //refItem = new ReferenceItem(
            //    Path.Combine(outputDir, "Tests.Shapes.xml"),
            //    Path.Combine(outputDir, "Tests.Shapes.dll"));
            //refItem.XamlSyntax = true;
            //apiContent.Add(refItem);

            //refItem = new ReferenceItem(
            //    Path.Combine(outputDir, "Tests.Geometries.xml"),
            //    Path.Combine(outputDir, "Tests.Geometries.dll"));
            //refItem.XamlSyntax = true;
            //apiContent.Add(refItem);

            //documenter.AddGroup(apiGroup);

            ReferenceLinkSource linkSource = new ReferenceLinkSource();

            refItem = new ReferenceItem(projectDoc, null);
            //refItem.XamlSyntax = true;
            linkSource.Add(refItem);

            refItem = new ReferenceItem(
                Path.Combine(outputDir, "Tests.Shapes.xml"),
                Path.Combine(outputDir, "Tests.Shapes.dll"));
            //refItem.XamlSyntax = true;
            linkSource.Add(refItem);

            refItem = new ReferenceItem(
                Path.Combine(outputDir, "Tests.Geometries.xml"),
                Path.Combine(outputDir, "Tests.Geometries.dll"));
            //refItem.XamlSyntax = true;
            linkSource.Add(refItem);

            engineSettings.AddLinkSource(linkSource);
        }
Esempio n. 12
0
        public static void Create(BuildDocumenter documenter,
                                  TestOptions options)
        {
            if (!options.BuildReferences)
            {
                return;
            }

            BuildSettings settings = documenter.Settings;

            ReferenceEngineSettings engineSettings = settings.EngineSettings[
                BuildEngineType.Reference] as ReferenceEngineSettings;

            Debug.Assert(engineSettings != null);

            if (engineSettings == null)
            {
                return;
            }

            sampleDir     = options.SampleDir;
            workingDir    = options.WorkingDir;
            sandAssistDir = options.SandAssistDir;
            tocType       = options.TocType;

            // Decide which namespace layout: Flat or Hierarchical
            ReferencesTocType refTestType = ReferencesTocType.Hierarchical;

            // Decide whether to use namespace root container
            engineSettings.RootNamespaceContainer = true;
            if (refTestType == ReferencesTocType.Hierarchical)
            {
                ReferenceTocLayoutConfiguration tocLayout =
                    engineSettings.TocLayout;
                tocLayout.ContentsAfter = false;
                tocLayout.LayoutType    = ReferenceTocLayoutType.Hierarchical;
            }

            // Test most reference topic options, including...
            // 1. Code snippets
            // 2. Version information: Advanced
            // 3. Media/Image contents
            // 4. Reference filters
            TestMain(documenter, options, engineSettings);

            // Test mainly hierarchical table of contents, including...
            // 1. tocexclude/excludetoc tag support
            // 2. Extension methods
            // 3. Version information: Assembly-And-File
            // 4. Linking to conceptual help contents
            // 5. Events
            TestHierarchicalToc(documenter, options, engineSettings);

            // Test assembly redirection and auto-dependency resolution, including...
            // 1. .NET 4 features (including Action<...> and Func<...>)
            // 2. Embedding contents. You can include linked third-party library
            //    documentation, which will not show in TOC but accessible from links
            // 3. WPF features like Xmlns-For-Xaml and Xaml usage.
            // 4. Version information: Assembly
            //TestRedirection(documenter, options, engineSettings);

            // Test for WPF 4.0 and Silverlight 4.0 assemblies, including...
            // 1. WPF features like Xmlns-For-Xaml and Xaml usage.
            // 2. Version information: None
            //TestSilverlightWPF(documenter, options, engineSettings);

            // Test other features...
            // 1. Testing C++/CLR library
            // 2. Version information: Assembly-And-File
            //    Has no file version. Assembly version is auto-incremental.
            // 3. Support for Visual C++ Project content source.
            //TestOthers(documenter, options, engineSettings);
        }
Esempio n. 13
0
        public static void Create(BuildDocumenter documenter,
                                  TestOptions options)
        {
            CustomTocType tocType = options.TocType;

            if (tocType == CustomTocType.None)
            {
                return;
            }

            BuildSettings           settings       = documenter.Settings;
            ReferenceEngineSettings engineSettings = settings.EngineSettings[
                BuildEngineType.Reference] as ReferenceEngineSettings;

            IList <BuildGroup> listGroups = documenter.Groups;

            // Create a custom TOC layout for the CHM format only...
            if (tocType != CustomTocType.Default)
            {
                FormatChm chmFormat =
                    settings.Formats[BuildFormatType.HtmlHelp1] as FormatChm;
                if (chmFormat != null && chmFormat.Enabled)
                {
                    TocContent chmTocContent = new TocContent();
                    for (int i = 0; i < listGroups.Count; i++)
                    {
                        TocItem tocItem = new TocItem();
                        tocItem.SourceType      = TocItemSourceType.Group;
                        tocItem.SourceRecursive = true;
                        tocItem.SourceId        = listGroups[i].Id;
                        chmTocContent.Add(tocItem);
                    }

                    chmFormat.TocContent = chmTocContent;
                }
            }

            BuildToc   buildToc   = settings.Toc;
            TocContent tocContent = buildToc.Content;

            switch (tocType)
            {
            case CustomTocType.None:
                break;

            case CustomTocType.Default:
                for (int i = 0; i < listGroups.Count; i++)
                {
                    TocItem tocItem = new TocItem();
                    tocItem.SourceType      = TocItemSourceType.Group;
                    tocItem.SourceRecursive = true;
                    tocItem.SourceId        = listGroups[i].Id;
                    tocContent.Add(tocItem);
                }
                break;

            case CustomTocType.ReferenceRoot:
                // Assumes there are three groups and the third is reference group,
                // and root namespaces container is enabled...
                if (listGroups.Count == 3 &&
                    (engineSettings != null && engineSettings.RootNamespaceContainer))
                {
                    TocItem rootItem = new TocItem();
                    rootItem.SourceType      = TocItemSourceType.NamespaceRoot;
                    rootItem.SourceRecursive = false;
                    rootItem.SourceId        = listGroups[2].Id;
                    tocContent.Add(rootItem);

                    for (int i = 0; i < listGroups.Count - 1; i++)
                    {
                        TocItem tocItem = new TocItem();
                        tocItem.SourceType      = TocItemSourceType.Group;
                        tocItem.SourceRecursive = true;
                        tocItem.SourceId        = listGroups[i].Id;
                        rootItem.Add(tocItem);
                    }

                    TocItem namespaceItem1 = new TocItem();
                    namespaceItem1.SourceType      = TocItemSourceType.Namespace;
                    namespaceItem1.SourceRecursive = true;
                    namespaceItem1.SourceId        = "N:ANamespace";
                    rootItem.Add(namespaceItem1);

                    TocItem namespaceItem2 = new TocItem();
                    namespaceItem2.SourceType      = TocItemSourceType.Namespace;
                    namespaceItem2.SourceRecursive = true;
                    namespaceItem2.SourceId        = "N:TestLibrary";
                    rootItem.Add(namespaceItem2);
                }
                break;

            case CustomTocType.TopicRoot:
                if (settings.BuildConceptual && settings.BuildReferences)
                {
                    TocItem rootTocItem = new TocItem();
                    rootTocItem.SourceType      = TocItemSourceType.Topic;
                    rootTocItem.SourceRecursive = true;
                    rootTocItem.SourceId        = "d36e744f-c053-4e94-9ac9-b1ee054d8de2";
                    tocContent.Add(rootTocItem);
                    for (int i = 0; i < listGroups.Count; i++)
                    {
                        TocItem tocItem = new TocItem();
                        tocItem.SourceType      = TocItemSourceType.Group;
                        tocItem.SourceRecursive = true;
                        tocItem.SourceId        = listGroups[i].Id;
                        rootTocItem.Add(tocItem);
                    }
                }
                break;
            }
        }
        private static void TestOther2(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\Development\Source\Tests\MvcApplication1\MvcApplication1.sln";
            string sourceFile =
                @"F:\SandcastleAssist\Development\Source\Tests\MvcApplication2\MvcApplication2.csproj";
            ReferenceVsNetSource vsSource = new ReferenceVsNetSource();
            ReferenceVsNetItem   vsItem   = new ReferenceVsNetItem(
                new BuildFilePath(sourceFile));

            vsItem.XamlSyntax = false;
            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 ASP.NET MVC Library", Guid.NewGuid().ToString(), vsSource);

            apiGroup.RunningHeaderText = "Sandcastle Helpers: ASP.NET MVC";

            apiGroup.VersionType = ReferenceVersionType.AssemblyAndFile;

            if (engineSettings.RootNamespaceContainer)
            {
                apiGroup.RootNamespaceTitle = "Testing ASP.NET MVC";
            }

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

            //ReferenceLinkSource linkSource = new ReferenceLinkSource();
            //linkSource.LinkType = BuildLinkType.Msdn;
            //linkSource.Title = "ASP.NET MVC 3 Framework";
            //linkSource.FrameworkType = BuildFrameworkType.Framework40;

            //string aspMVCDir =
            //    @"E:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies";

            //ReferenceItem refItem = new ReferenceItem(
            //    Path.Combine(aspMVCDir, "System.Web.Mvc.xml"),
            //    Path.Combine(aspMVCDir, "System.Web.Mvc.dll"));
            ////refItem.XamlSyntax = true;
            //linkSource.Add(refItem);

            //engineSettings.AddLinkSource(linkSource);

            engineSettings.WebMvcSdkType = BuildSpecialSdkType.WebMvc04;
        }
Esempio n. 15
0
        protected override bool OnExecute(BuildContext context)
        {
            Debug.Assert(_group != null);
            if (_group == null)
            {
                return(false);
            }

            ReferenceGroupContext groupContext =
                context.GroupContexts[_group.Id] as ReferenceGroupContext;

            if (groupContext == null)
            {
                throw new BuildException(
                          "The group context is not provided, and it is required by the build system.");
            }

            // Create the documents...
            string reflectionFile = groupContext["$ReflectionFile"];
            string refInfoFile    = Path.ChangeExtension(reflectionFile, ".org");

            string workingDir = this.WorkingDirectory;

            _listDocuments = new List <ReferenceDocument>();
            // the reflection file...
            ReferenceDocument document = new ReferenceDocument(
                Path.Combine(workingDir, refInfoFile),
                ReferenceDocumentType.Reflection);

            _listDocuments.Add(document);
            // the comment files...
            IList <string> commentFiles = groupContext.CommentFiles;

            if (commentFiles != null && commentFiles.Count != 0)
            {
                for (int i = 0; i < commentFiles.Count; i++)
                {
                    document = new ReferenceDocument(commentFiles[i],
                                                     ReferenceDocumentType.Comments);
                    _listDocuments.Add(document);
                }
            }

            if (_listDocuments == null || _listDocuments.Count == 0)
            {
                return(false);
            }

            // We need the list of the available configurations from the
            // reference settings...
            BuildSettings settings = context.Settings;

            Debug.Assert(settings != null,
                         "The settings is not associated with the context.");
            if (settings == null)
            {
                return(false);
            }
            BuildEngineSettingsList listSettings = settings.EngineSettings;

            Debug.Assert(listSettings != null,
                         "The settings does not include the engine settings.");
            if (listSettings == null || listSettings.Count == 0)
            {
                return(false);
            }
            _engineSettings = listSettings[BuildEngineType.Reference] as ReferenceEngineSettings;

            Debug.Assert(_engineSettings != null,
                         "The settings does not include the reference engine settings.");
            if (_engineSettings == null)
            {
                return(false);
            }

            // 1. Create all the reference visitors...
            this.PrepareVisitors(context);
            if ((_dictVisitors == null || _dictVisitors.Count == 0) ||
                (_listConfigurations == null || _listConfigurations.Count == 0))
            {
                return(true);
            }

            // 2. Initialize all the reference visitors...
            ICollection <ReferenceVisitor> listVisitors = _dictVisitors.Values;

            foreach (ReferenceVisitor visitor in listVisitors)
            {
                visitor.Initialize(context, _group);
            }

            // 3. Process the configurations...
            this.ProcessDocuments(context);

            // 4. Un-initialize all the reference visitors...
            foreach (ReferenceVisitor visitor in listVisitors)
            {
                visitor.Uninitialize();
            }

            return(true);
        }
Esempio n. 16
0
        private bool OnEndModel(BuildContext context)
        {
            BuildGroupContext groupContext = context.GroupContexts[_group.Id];

            if (groupContext == null)
            {
                throw new BuildException(
                          "The group context is not provided, and it is required by the build system.");
            }

            string workingDir = context.WorkingDirectory;

            // We need the list of the available configurations from the
            // reference settings...
            BuildSettings settings = context.Settings;

            Debug.Assert(settings != null,
                         "The settings is not associated with the context.");
            if (settings == null)
            {
                return(false);
            }
            BuildEngineSettingsList listSettings = settings.EngineSettings;

            Debug.Assert(listSettings != null,
                         "The settings does not include the engine settings.");
            if (listSettings == null || listSettings.Count == 0)
            {
                return(false);
            }
            ReferenceEngineSettings engineSettings =
                listSettings[BuildEngineType.Reference] as ReferenceEngineSettings;

            Debug.Assert(engineSettings != null,
                         "The settings does not include the reference engine settings.");
            if (engineSettings == null)
            {
                return(false);
            }

            // We currently only change the file name of the root namespace,
            // if any, to avoid overrides in multiple API builds...
            if (!engineSettings.RootNamespaceContainer)
            {
                return(true);
            }

            string reflectionFile = String.Empty;

            if (!String.IsNullOrEmpty(workingDir) && Directory.Exists(workingDir))
            {
                reflectionFile = Path.Combine(workingDir, groupContext["$ReflectionFile"]);
            }
            if (!File.Exists(reflectionFile))
            {
                return(false);
            }
            XmlDocument document = new XmlDocument();

            document.Load(reflectionFile);

            XmlNode projectNode = document.SelectSingleNode(
                "reflection/apis/api[@id='R:Project']");

            if (projectNode == null)
            {
                return(false);
            }
            XmlNode fileNode = projectNode.SelectSingleNode("file");

            if (fileNode == null)
            {
                return(false);
            }

            if (String.Equals(fileNode.Attributes["name"].Value,
                              "d4648875-d41a-783b-d5f4-638df39ee413", StringComparison.OrdinalIgnoreCase))
            {
                fileNode.Attributes["name"].Value = _group.Id.ToLower();
                document.Save(reflectionFile);
            }

            return(true);
        }