Esempio n. 1
0
        public Context(IMessageReporter messageReporter, Configuration configuration)
        {
            ProblemReporter = new ProblemReporter(messageReporter);
            Configuration = configuration;

            SchemaSetManager = new SchemaSetManager(this);
            SchemaSetManager.Initialize();

            SourceCodeManager = new SourceCodeManager(this);
            SourceCodeManager.Initialize();

            TopicManager = new TopicManager(this);
            TopicManager.Initialize();

            DocumentationManager = new DocumentationManager(this);
            DocumentationManager.Initialize();
        }
Esempio n. 2
0
 public ContentGenerator(IMessageReporter messageReporter, Configuration configuration)
 {
     _context = new Context(messageReporter, configuration);
     MediaItems = new List<MediaItem>();
     TopicFiles = new List<string>();
 }
Esempio n. 3
0
        /// <summary>
        /// This method is used to execute the plug-in during the build process
        /// </summary>
        /// <param name="executionContext">The current execution context</param>
        public void Execute(ExecutionContext executionContext)
        {
            _buildProcess.ReportProgress(Resources.PlugInBuildProgress);
            var messageReporter = new MessageReporter(_buildProcess);
            var configuration = new Configuration
                                {
                                    OutputFolderPath = _buildProcess.WorkingFolder,
                                    DocumentRootSchemas = _configuration.DocumentRootSchemas,
                                    DocumentRootElements = _configuration.DocumentRootElements,
                                    DocumentConstraints = _configuration.DocumentConstraints,
                                    DocumentSchemas = _configuration.DocumentSchemas,
                                    DocumentSyntax = _configuration.DocumentSyntax,
                                    UseTypeDocumentationForUndocumentedAttributes = _configuration.UseTypeDocumentationForUndocumentedAttributes,
                                    UseTypeDocumentationForUndocumentedElements = _configuration.UseTypeDocumentationForUndocumentedElements,
                                    SchemaSetContainer = _configuration.SchemaSetContainer,
                                    SchemaSetTitle = _configuration.SchemaSetTitle,
                                    NamespaceContainer = _configuration.NamespaceContainer,
                                    IncludeLinkUriInKeywordK = _configuration.IncludeLinkUriInKeywordK,
                                    AnnotationTransformFileName = _configuration.AnnotationTransformFilePath.ExpandedPath,
                                    SchemaFileNames = ExpandFiles(_configuration.SchemaFilePaths),
                                    SchemaDependencyFileNames = ExpandFiles(_configuration.SchemaDependencyFilePaths),
                                    DocFileNames = ExpandFiles(_configuration.DocFilePaths)
                                };

            var contentGenerator = new ContentGenerator(messageReporter, configuration);
            contentGenerator.Generate();

            var contentLayoutItem = AddLinkedItem(BuildAction.ContentLayout, contentGenerator.ContentFile);
            contentLayoutItem.SetMetadataValue("SortOrder", Convert.ToString(_configuration.SortOrder, CultureInfo.InvariantCulture));

            foreach (var topicFileName in contentGenerator.TopicFiles)
                AddLinkedItem(BuildAction.None, topicFileName);

            foreach (var mediaItem in contentGenerator.MediaItems)
            {
                var mediaFileItem = AddLinkedItem(BuildAction.Image, mediaItem.FileName);
                mediaFileItem.SetMetadataValue("ImageId", mediaItem.ArtItem.Id);
                mediaFileItem.SetMetadataValue("AlternateText", mediaItem.ArtItem.AlternateText);
            }

            var componentConfig = GetComponentConfiguration(contentGenerator.IndexFile);

            _buildProcess.CurrentProject.ComponentConfigurations.Add(GetComponentId(), true, componentConfig);

            // Needed so that all links are properly evaluated before processed by SHFB.
            _tempProject.MSBuildProject.ReevaluateIfNecessary();

            // Add the items to the conceptual content settings
            _buildProcess.ConceptualContent.MergeContentFrom(_tempProject);
        }