public virtual void Initialize(BuildContext context, ReferenceGroup group)
        {
            BuildExceptions.NotNull(context, "context");
            BuildExceptions.NotNull(group, "group");

            if (_isInitialized)
            {
                return;
            }

            _context = context;
            _group   = group;

            if (_engineSettings == null)
            {
                BuildSettings settings = context.Settings;
                Debug.Assert(settings != null,
                             "The settings is not associated with the context.");
                if (settings == null)
                {
                    return;
                }
                _engineSettings = (ReferenceEngineSettings)settings.EngineSettings[
                    BuildEngineType.Reference];
                Debug.Assert(_engineSettings != null,
                             "The settings does not include the reference engine settings.");
                if (_engineSettings == null)
                {
                    return;
                }
            }

            _isInitialized = true;
        }
        public override void Initialize(BuildContext context, ReferenceGroup group)
        {
            base.Initialize(context, group);

            if (this.IsInitialized)
            {
                if (_comments == null)
                {
                    ReferenceEngineSettings engineSettings = this.EngineSettings;

                    Debug.Assert(engineSettings != null);
                    if (engineSettings == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }

                    _comments = engineSettings.Comments;
                    Debug.Assert(_comments != null);
                    if (_comments == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }
                }
            }
        }
        public override void Initialize(BuildContext context, ReferenceGroup group)
        {
            base.Initialize(context, group);

            _notApplicable = false;

            BuildGroupContext groupContext = context.GroupContexts[group.Id];
            if (groupContext != null)
            {
                // We do not have to spell check embedded documents...
                string embeddedText = groupContext["$IsEmbeddedGroup"];
                if (!String.IsNullOrEmpty(embeddedText) && 
                    embeddedText.Equals(Boolean.TrueString, StringComparison.OrdinalIgnoreCase))
                {
                    _notApplicable = true;
                    return;
                }
            }

            if (this.IsInitialized)
            {
                if (_spellChecking == null)
                {
                    ReferenceEngineSettings engineSettings = this.EngineSettings;

                    Debug.Assert(engineSettings != null);
                    if (engineSettings == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }

                    _spellChecking = engineSettings.SpellChecking;
                    Debug.Assert(_spellChecking != null);
                    if (_spellChecking == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }
                }

                _spellChecker = BuildSpellChecker.Default;
                if (_spellChecker != null)
                {
                    _spellChecker.Initialize(context);
                    if (!_spellChecker.IsInitialized)
                    {
                        this.IsInitialized = false;
                        return;
                    }
                }

                ICollection<string> configSkips = _spellChecking.SkipTags;
                if (configSkips != null && configSkips.Count != 0)
                {
                    _skipTags.UnionWith(configSkips);
                }
            }
        }
        public override void Initialize(BuildContext context, ReferenceGroup group)
        {
            base.Initialize(context, group);

            _notApplicable = false;

            BuildGroupContext groupContext = context.GroupContexts[group.Id];

            if (groupContext != null)
            {
                // We do not have to spell check embedded documents...
                string embeddedText = groupContext["$IsEmbeddedGroup"];
                if (!String.IsNullOrEmpty(embeddedText) &&
                    embeddedText.Equals(Boolean.TrueString, StringComparison.OrdinalIgnoreCase))
                {
                    _notApplicable = true;
                    return;
                }
            }

            if (this.IsInitialized)
            {
                if (_tocLayout == null)
                {
                    ReferenceEngineSettings engineSettings = this.EngineSettings;

                    Debug.Assert(engineSettings != null);
                    if (engineSettings == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }

                    _tocLayout = engineSettings.TocLayout;
                    Debug.Assert(_tocLayout != null);

                    if (_tocLayout == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }
                }

                _contentsAfter = _tocLayout.ContentsAfter;

                ReferenceTocLayoutType layoutType = _tocLayout.LayoutType;
                if (layoutType != ReferenceTocLayoutType.Hierarchical &&
                    layoutType != ReferenceTocLayoutType.Custom)
                {
                    this.IsInitialized = false;
                    return;
                }
            }
        }
        /// <summary>
        /// This creates a new build object that is a deep copy of the current
        /// instance.
        /// </summary>
        /// <returns>
        /// A new build object that is a deep copy of this instance.
        /// </returns>
        public override BuildEngineSettings Clone()
        {
            ReferenceEngineSettings settings = new ReferenceEngineSettings(this);

            this.OnClone(settings);
            if (_topicLinks != null && _topicLinks.Count != 0)
            {
                settings._topicLinks = _topicLinks.Clone();
            }

            return(settings);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ReferenceEngineSettings"/> class
 /// with parameters copied from the specified instance of the
 /// <see cref="ReferenceEngineSettings"/> class, a copy constructor.
 /// </summary>
 /// <param name="source">
 /// An instance of the <see cref="ReferenceEngineSettings"/> class from which the
 /// initialization parameters or values will be copied.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// If the parameter <paramref name="source"/> is <see langword="null"/>.
 /// </exception>
 public ReferenceEngineSettings(ReferenceEngineSettings source)
     : base(source)
 {
     _topicLinks                     = source._topicLinks;
     _refNaming                      = source._refNaming;
     _webMvcSdkType                  = source._webMvcSdkType;
     _refNamer                       = source._refNamer;
     _rootContainer                  = source._rootContainer;
     _embedScriptSharp               = source._embedScriptSharp;
     _includeAllMembersTopic         = source._includeAllMembersTopic;
     _includeInheritedOverloadTopics = source._includeInheritedOverloadTopics;
 }
        protected ReferenceVisitor(ReferenceVisitor source)
            : base(source)
        {
            _name = source._name;

            if (_name != null)
            {
                _name = String.Copy(_name);
            }

            _engineSettings = source._engineSettings;
        }
Example #8
0
        public override void Initialize(BuildContext context)
        {
            base.Initialize(context);

            if (!this.IsInitialized)
            {
                return;
            }

            _settings = context.Settings;
            if (_settings == null || _settings.Style == null)
            {
                this.IsInitialized = false;

                return;
            }
            _engineSettings = _settings.EngineSettings[
                BuildEngineType.Reference] as ReferenceEngineSettings;
            Debug.Assert(_engineSettings != null,
                         "The settings does not include the reference engine settings.");
            if (_engineSettings == null)
            {
                this.IsInitialized = false;

                return;
            }

            _componentConfigList = _engineSettings.ComponentConfigurations;
            if (_componentConfigList != null && _componentConfigList.Count != 0)
            {
                _componentConfigList.Initialize(context);
            }

            _style = _settings.Style;

            //Keyword: "$(SandcastleCopyComponent)";
            if (ContainsComponents("SandcastleCopyComponent") == false)
            {
                string sandcastlePath = context.SandcastleDirectory;

                if (String.IsNullOrEmpty(sandcastlePath) == false ||
                    Directory.Exists(sandcastlePath))
                {
                    string copyComponents = Path.Combine(sandcastlePath,
                                                         @"ProductionTools\CopyComponents.dll");
                    RegisterComponents("SandcastleCopyComponent", copyComponents);
                }
            }

            this.RegisterItemHandlers();
        }
Example #9
0
        public override void Initialize(BuildContext context, ReferenceGroup group)
        {
            base.Initialize(context, group);

            _notApplicable = false;

            BuildGroupContext groupContext = context.GroupContexts[group.Id];

            if (groupContext != null)
            {
                // We do not have to spell check embedded documents...
                string embeddedText = groupContext["$IsEmbeddedGroup"];
                if (!String.IsNullOrEmpty(embeddedText) &&
                    embeddedText.Equals(Boolean.TrueString, StringComparison.OrdinalIgnoreCase))
                {
                    _notApplicable = true;
                    return;
                }
            }

            if (this.IsInitialized)
            {
                if (_visibility == null)
                {
                    ReferenceEngineSettings engineSettings = this.EngineSettings;

                    Debug.Assert(engineSettings != null);
                    if (engineSettings == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }

                    _visibility = engineSettings.Visibility;
                    Debug.Assert(_visibility != null);
                    if (_visibility == null)
                    {
                        this.IsInitialized = false;
                        return;
                    }
                }
            }
        }
        public override void Initialize(BuildFormat format,
                                        BuildSettings settings, BuildGroup group)
        {
            base.Initialize(format, settings, group);

            if (!this.IsInitialized)
            {
                return;
            }

            _engineSettings = settings.EngineSettings[
                BuildEngineType.Reference] as ReferenceEngineSettings;
            Debug.Assert(_engineSettings != null,
                         "The settings does not include the reference engine settings.");
            if (_engineSettings == null)
            {
                this.IsInitialized = false;
                return;
            }
        }
        public void Initialize(BuildContext context, string defaultAttrFile)
        {
            BuildExceptions.NotNull(context, "context");

            base.Initialize(context.Logger);

            BuildSettings settings = context.Settings;

            if (settings == null)
            {
                this.IsInitialized = false;
                return;
            }
            _engineSettings = (ReferenceEngineSettings)settings.EngineSettings[
                BuildEngineType.Reference];
            Debug.Assert(_engineSettings != null,
                         "The settings does not include the reference engine settings.");
            if (_engineSettings == null)
            {
                return;
            }

            _settings        = settings;
            _context         = context;
            _defaultAttrFile = defaultAttrFile;

            if (!String.IsNullOrEmpty(_defaultAttrFile) &&
                File.Exists(_defaultAttrFile))
            {
                string configDir     = Path.GetDirectoryName(_defaultAttrFile);
                string apiFilterFile = Path.Combine(configDir, DefaultApiFilterFile);
                if (File.Exists(apiFilterFile))
                {
                    _compilerRootFilter = new ReferenceRootFilter();
                    _compilerRootFilter.Load(apiFilterFile);
                }
            }

            _assistComponents = null;
            if (_context.IsDirectSandcastle)
            {
                string sandcastleAssist = _settings.SandAssistDirectory;
                if (!String.IsNullOrEmpty(sandcastleAssist) &&
                    Directory.Exists(sandcastleAssist))
                {
                    // If the Sandcastle Assist component assembly is in the same
                    // directory as the Sandcastle Helpers...
                    string tempText = Path.Combine(sandcastleAssist,
                                                   "Sandcastle.Reflection.dll");
                    if (File.Exists(tempText))
                    {
                        _assistComponents = tempText;
                    }
                }
            }

            // 1. The reference ...
            this.RegisterItem(KeywordNamer,
                              new Action <string, XPathNavigator>(OnNamerItem));
            // 2. The reference ...
            this.RegisterItem(KeywordAddins,
                              new Action <string, XPathNavigator>(OnAddinsItem));
            // 3. The reference ...
            this.RegisterItem(KeywordPlatform,
                              new Action <string, XPathNavigator>(OnPlatformItem));
            // 4. The reference ...
            this.RegisterItem(KeywordResolver,
                              new Action <string, XPathNavigator>(OnResolverItem));
            // 5. The reference ...
            this.RegisterItem(KeywordOptions,
                              new Action <string, XPathNavigator>(OnOptionsItem));
            // 6. The reference ...
            this.RegisterItem(KeywordApiFilter,
                              new Action <string, XPathNavigator>(OnApiFilterItem));
            // 7. The reference ...
            this.RegisterItem(KeywordAttributeFilter,
                              new Action <string, XPathNavigator>(OnAttributeFilterItem));

            this.IsInitialized = true;
        }
        /// <summary>
        /// The creates the configuration information or settings required by the
        /// target component for the build process.
        /// </summary>
        /// <param name="group">
        /// A build group, <see cref="BuildGroup"/>, representing the documentation
        /// target for configuration.
        /// </param>
        /// <param name="writer">
        /// An <see cref="XmlWriter"/> object used to create one or more new
        /// child nodes at the end of the list of child nodes of the current node.
        /// </param>
        /// <returns>
        /// Returns <see langword="true"/> for a successful configuration;
        /// otherwise, it returns <see langword="false"/>.
        /// </returns>
        /// <remarks>
        /// The <see cref="XmlWriter"/> writer passed to this configuration object
        /// may be passed on to other configuration objects, so do not close or
        /// dispose it.
        /// </remarks>
        public override bool Configure(BuildGroup group, XmlWriter writer)
        {
            BuildExceptions.NotNull(group, "group");
            BuildExceptions.NotNull(writer, "writer");

            IBuildNamedList <BuildGroupContext> groupContexts = _context.GroupContexts;

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

            ReferenceGroupContext groupContext = 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.");
            }

            if (!this.Enabled || !this.IsInitialized)
            {
                return(false);
            }

            BuildFramework     framework = groupContext.Framework;
            BuildFrameworkKind kind      = framework.FrameworkType.Kind;

            ReferenceEngineSettings referenceSettings = _settings.EngineSettings[
                BuildEngineType.Reference] as ReferenceEngineSettings;
            BuildSpecialSdkType webSdkType = referenceSettings.WebMvcSdkType;

            writer.WriteStartElement("options");   // start - options
            writer.WriteAttributeString("locale",
                                        _settings.CultureInfo.Name.ToLower());
            if (kind == BuildFrameworkKind.Silverlight)
            {
                writer.WriteAttributeString("version", "VS.95");
            }
            else if (kind == BuildFrameworkKind.Compact)
            {
                // The framework 3.5 is the last version of Windows CE...
                writer.WriteAttributeString("version", "VS.90");
            }
            if (webSdkType != BuildSpecialSdkType.Null &&
                webSdkType != BuildSpecialSdkType.None)
            {
                switch (webSdkType.Value)
                {
                case 10:        // ASP.NET MVC 1.0: Supported in .NET 3.5
                    writer.WriteAttributeString("mvcVersion", "VS.90");
                    break;

                case 20:        // ASP.NET MVC 2.0: Supported in .NET 3.5 SP1
                    // This is currently the default documentation for
                    // the ASP.NET MVC Framework...
                    writer.WriteAttributeString("mvcVersion", "");
                    break;

                case 30:        // ASP.NET MVC 3.0: Supported in .NET 4.0
                    writer.WriteAttributeString("mvcVersion", "VS.98");
                    break;

                case 40:        // ASP.NET MVC 4.0: Supported in .NET 4.5
                    writer.WriteAttributeString("mvcVersion", "VS.108");
                    break;
                }
            }
            writer.WriteAttributeString("linkTarget",
                                        "_" + _format.ExternalLinkTarget.ToString().ToLower());
            writer.WriteEndElement();              // end - options

            bool   isEmbeddedGroup    = false;
            bool   frameworkAvailable = false;
            bool   isEmbeddedScript   = groupContext.IsEmbeddedGroup;
            string tempText           = _context["$EmbeddedScriptSharp"];

            if (!String.IsNullOrEmpty(tempText))
            {
                isEmbeddedScript = Convert.ToBoolean(tempText);
            }

            List <DataSource> dataSources = new List <DataSource>();

            if (kind == BuildFrameworkKind.Silverlight)
            {
                string silverlightDir = groupContext["$SilverlightDataDir"];

                if (!String.IsNullOrEmpty(silverlightDir) &&
                    Directory.Exists(silverlightDir))
                {
                    frameworkAvailable = true;

                    writer.WriteStartElement("targets");
                    writer.WriteAttributeString("base", silverlightDir);
                    writer.WriteAttributeString("recurse", "false");
                    writer.WriteAttributeString("system", "true");
                    writer.WriteAttributeString("files", "*.xml");
                    writer.WriteAttributeString("type",
                                                _format.ExternalLinkType.ToString().ToLower());

                    // Write the data source...
                    Version latestVersion = BuildFrameworks.LatestSilverlightVersion;
                    if (latestVersion == null)
                    {
                        latestVersion = framework.Version;
                    }
                    this.WriteDataSource(writer, DataSourceType.Silverlight,
                                         silverlightDir, latestVersion, true, true, dataSources);

                    writer.WriteEndElement();
                }
            }
            else if (kind == BuildFrameworkKind.Portable)
            {
                string portableDir = groupContext["$PortableDataDir"];

                if (!String.IsNullOrEmpty(portableDir) && Directory.Exists(portableDir))
                {
                    frameworkAvailable = true;

                    writer.WriteStartElement("targets");
                    writer.WriteAttributeString("base", portableDir);
                    writer.WriteAttributeString("recurse", "false");
                    writer.WriteAttributeString("system", "true");
                    writer.WriteAttributeString("files", "*.xml");
                    writer.WriteAttributeString("type",
                                                _format.ExternalLinkType.ToString().ToLower());

                    // Write the data source...
                    Version latestVersion = BuildFrameworks.LatestPortableVersion;
                    if (latestVersion == null)
                    {
                        latestVersion = framework.Version;
                    }
                    this.WriteDataSource(writer, DataSourceType.Portable,
                                         portableDir, latestVersion, true, false, dataSources);

                    writer.WriteEndElement();
                }
            }
            else if (kind == BuildFrameworkKind.ScriptSharp)
            {
                string scriptSharpDir = groupContext["$ScriptSharpDataDir"];

                if (!String.IsNullOrEmpty(scriptSharpDir) && Directory.Exists(scriptSharpDir))
                {
                    frameworkAvailable = true;

                    if (!isEmbeddedGroup)
                    {
                        writer.WriteStartElement("targets");
                        writer.WriteAttributeString("base", scriptSharpDir);
                        writer.WriteAttributeString("recurse", "false");
                        writer.WriteAttributeString("system", "true");
                        writer.WriteAttributeString("files", "*.xml");

                        if (isEmbeddedScript)
                        {
                            writer.WriteAttributeString("type",
                                                        BuildLinkType.Local.ToString().ToLower());
                        }
                        else
                        {
                            writer.WriteAttributeString("type",
                                                        BuildLinkType.None.ToString().ToLower());
                        }

                        // Write the data source...
                        Version latestVersion = BuildFrameworks.LatestScriptSharpVersion;
                        if (latestVersion == null)
                        {
                            latestVersion = framework.Version;
                        }
                        this.WriteDataSource(writer, DataSourceType.ScriptSharp,
                                             scriptSharpDir, latestVersion, true, false, dataSources);

                        writer.WriteEndElement();
                    }
                }
            }

            // If not specialized framework, then write the default...
            if (!frameworkAvailable || kind == BuildFrameworkKind.None ||
                kind == BuildFrameworkKind.DotNet || kind == BuildFrameworkKind.Compact)
            {
                string dotNetDataDir = Path.GetFullPath(
                    Environment.ExpandEnvironmentVariables(ReferenceEngine.ReflectionDirectory));

                writer.WriteStartElement("targets");
                writer.WriteAttributeString("base", dotNetDataDir);
                writer.WriteAttributeString("recurse", "true");
                writer.WriteAttributeString("system", "true");
                writer.WriteAttributeString("files", "*.xml");
                writer.WriteAttributeString("type",
                                            _format.ExternalLinkType.ToString().ToLower());

                // Write the data source...
                this.WriteDataSource(writer, DataSourceType.Framework,
                                     dotNetDataDir, ReferenceEngine.ReflectionVersion, true,
                                     false, dataSources);

                writer.WriteEndElement();
            }

            // The Portable and ScriptSharp do not support Blend...
            if (kind != BuildFrameworkKind.Portable &&
                kind != BuildFrameworkKind.Compact &&
                kind != BuildFrameworkKind.ScriptSharp)
            {
                string blendDir = groupContext["$BlendDataDir"];

                if (!String.IsNullOrEmpty(blendDir) && Directory.Exists(blendDir))
                {
                    writer.WriteStartElement("targets");
                    writer.WriteAttributeString("base", blendDir);
                    writer.WriteAttributeString("recurse", "false");
                    writer.WriteAttributeString("system", "true");
                    writer.WriteAttributeString("files", "*.xml");
                    writer.WriteAttributeString("type",
                                                _format.ExternalLinkType.ToString().ToLower());

                    // Write the data source...
                    BuildSpecialSdk latestBlendSdk = null;
                    if (kind == BuildFrameworkKind.Silverlight)
                    {
                        latestBlendSdk = BuildSpecialSdks.LatestBlendSilverlightSdk;
                    }
                    else
                    {
                        latestBlendSdk = BuildSpecialSdks.LatestBlendWpfSdk;
                    }
                    Version latestVersion = (latestBlendSdk == null) ?
                                            null : latestBlendSdk.Version;
                    if (latestVersion == null)
                    {
                        latestVersion = framework.Version;
                    }
                    this.WriteDataSource(writer, DataSourceType.Blend, blendDir,
                                         latestVersion, true, kind == BuildFrameworkKind.Silverlight,
                                         dataSources);

                    writer.WriteEndElement();
                }
            }

            IList <string> linkDirs = _context.GetValue(
                "$ReferenceLinkDirectories") as IList <string>;
            IList <ReferenceLinkSource> linkSources = _context.GetValue(
                "$ReferenceLinkSources") as IList <ReferenceLinkSource>;

            if ((linkDirs != null && linkDirs.Count != 0) &&
                (linkSources != null && linkSources.Count == linkDirs.Count))
            {
                for (int i = 0; i < linkDirs.Count; i++)
                {
                    ReferenceLinkSource linkSource     = linkSources[i];
                    BuildLinkType       sourceLinkType = linkSource.LinkType;

                    writer.WriteStartElement("targets");
                    writer.WriteAttributeString("base", linkDirs[i]);
                    writer.WriteAttributeString("recurse", "true");
                    writer.WriteAttributeString("system", "false");
                    writer.WriteAttributeString("files", "*.xml");
                    writer.WriteAttributeString("type",
                                                sourceLinkType.ToString().ToLower());

                    writer.WriteEndElement();
                }
            }

            BuildLinkType linkType     = _format.LinkType;
            string        linkTypeText = linkType.ToString().ToLower();

            // For the embedded group, we will not link to the other groups...
            if (!isEmbeddedGroup)
            {
                for (int i = 0; i < groupContexts.Count; i++)
                {
                    ReferenceGroupContext aContext = groupContexts[i]
                                                     as ReferenceGroupContext;

                    if (aContext == null || aContext.IsLinkGroup)
                    {
                        continue;
                    }

                    if (aContext.GroupType != BuildGroupType.Reference ||
                        aContext == groupContext)
                    {
                        continue;
                    }

                    string linkFile = aContext["$ReflectionFile"];
                    if (!String.IsNullOrEmpty(linkFile))
                    {
                        writer.WriteStartElement("targets");

                        writer.WriteAttributeString("base", @".\");
                        writer.WriteAttributeString("recurse", "false");
                        writer.WriteAttributeString("system", "false");
                        writer.WriteAttributeString("files", @".\" + linkFile);
                        writer.WriteAttributeString("type", linkTypeText);
                        writer.WriteEndElement();
                    }
                }
            }

            //<targets base=".\" recurse="false"
            //   files=".\reflection.xml" type="local" />
            writer.WriteStartElement("targets");
            writer.WriteAttributeString("base", @".\");
            writer.WriteAttributeString("recurse", "false");
            writer.WriteAttributeString("system", "false");
            writer.WriteAttributeString("files", @".\" + groupContext["$ReflectionFile"]);

            if (isEmbeddedGroup)
            {
                writer.WriteAttributeString("type",
                                            BuildLinkType.Local.ToString().ToLower());
            }
            else
            {
                writer.WriteAttributeString("type", linkTypeText);
            }

            writer.WriteEndElement();

            // Provide the information for the MSDN link resolvers...
            writer.WriteStartElement("linkResolver"); // start - linkResolver
            writer.WriteAttributeString("storage", _linkStorage.ToString().ToLower());
            writer.WriteAttributeString("cache", _cacheLinks ? "true" : "false");
            if (dataSources != null && dataSources.Count != 0)
            {
                for (int i = 0; i < dataSources.Count; i++)
                {
                    DataSource dataSource = dataSources[i];

                    this.WriteDataSource(writer, dataSource.SourceType,
                                         dataSource.InputDir, dataSource.Version,
                                         dataSource.IsDatabase, dataSource.IsSilverlight, true);
                }
            }
            writer.WriteEndElement();                 // end - linkResolver

            // Finally, provide the information for the conceptual links
            // in reference documents, if any...
            bool hasConceptualContext = _settings.BuildConceptual;

            if (hasConceptualContext)
            {
                hasConceptualContext = false;

                for (int i = 0; i < groupContexts.Count; i++)
                {
                    BuildGroupContext aContext = groupContexts[i];
                    if (aContext.GroupType == BuildGroupType.Conceptual)
                    {
                        hasConceptualContext = true;
                        break;
                    }
                }
            }

            if (hasConceptualContext)
            {
                ConceptualEngineSettings conceptualSettings = _settings.EngineSettings[
                    BuildEngineType.Conceptual] as ConceptualEngineSettings;
                Debug.Assert(conceptualSettings != null,
                             "The settings does not include the reference engine settings.");
                if (conceptualSettings == null)
                {
                    return(false);
                }
                ConceptualLinkConfiguration linkConfig =
                    conceptualSettings.ConceptualLinks;
                Debug.Assert(linkConfig != null,
                             "There is no conceptual link configuration available.");
                if (linkConfig == null)
                {
                    return(false);
                }

                writer.WriteStartElement("conceptualLinks");  //start: conceptualLinks
                writer.WriteAttributeString("enabled", "true");
                writer.WriteAttributeString("showText",
                                            linkConfig.ShowLinkText.ToString());
                writer.WriteAttributeString("showBrokenLinkText",
                                            linkConfig.ShowBrokenLinkText.ToString());
                writer.WriteAttributeString("type", linkTypeText);

                for (int i = 0; i < groupContexts.Count; i++)
                {
                    BuildGroupContext aContext = groupContexts[i];
                    if (aContext.GroupType == BuildGroupType.Conceptual)
                    {
                        writer.WriteStartElement("conceptualTargets");  // start - conceptualTargets
                        writer.WriteAttributeString("base", String.Format(
                                                        @".\{0}", aContext["$DdueXmlCompDir"]));
                        writer.WriteAttributeString("type", linkTypeText);
                        writer.WriteEndElement();                       // end - conceptualTargets
                    }
                }
                writer.WriteEndElement();                     //end: conceptualLinks
            }

            return(true);
        }
        public override void Initialize(BuildContext context, ReferenceGroup group)
        {
            base.Initialize(context, group);

            if (!this.IsInitialized)
            {
                return;
            }

            _notApplicable = false;

            context["$TocExcludedNamespaces"] = String.Empty;

            if (_tocExclude == null)
            {
                ReferenceEngineSettings engineSettings = this.EngineSettings;

                Debug.Assert(engineSettings != null);
                if (engineSettings == null)
                {
                    this.IsInitialized = false;

                    return;
                }

                _tocExclude = engineSettings.TocExclude;
                Debug.Assert(_tocExclude != null);

                if (_tocExclude == null)
                {
                    this.IsInitialized = false;
                    return;
                }
            }

            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.");
            }
            // We do not have to spell check embedded documents...
            string embeddedText = groupContext["$IsEmbeddedGroup"];

            if (!String.IsNullOrEmpty(embeddedText) &&
                embeddedText.Equals(Boolean.TrueString, StringComparison.OrdinalIgnoreCase))
            {
                _notApplicable = true;
                return;
            }

            IList <string> commentFiles = groupContext.CommentFiles;

            if (commentFiles != null && commentFiles.Count != 0)
            {
                _listTocExcludes = new BuildList <string>();

                for (int i = 0; i < commentFiles.Count; i++)
                {
                    XPathDocument  document          = new XPathDocument(commentFiles[i]);
                    XPathNavigator documentNavigator = document.CreateNavigator();

                    XPathNodeIterator iterator = documentNavigator.Select(
                        "//member[.//tocexclude or .//excludetoc]/@name");

                    if (iterator != null && iterator.Count != 0)
                    {
                        foreach (XPathNavigator navigator in iterator)
                        {
                            _listTocExcludes.Add(navigator.Value);
                        }
                    }
                }

                if (_listTocExcludes.Count == 0)
                {
                    this.IsInitialized = false;
                    return;
                }
            }
            else
            {
                this.IsInitialized = false;
                return;
            }
        }
Example #14
0
        public override void Initialize(BuildContext context)
        {
            if (this.IsInitialized)
            {
                return;
            }

            base.Initialize(context);
            if (!this.IsInitialized)
            {
                return;
            }

            if (_listGroups == null || _listGroups.Count == 0)
            {
                this.IsInitialized = false;
                return;
            }

            BuildSettings settings = this.Settings;

            _engineSettings = (ReferenceEngineSettings)settings.EngineSettings[
                BuildEngineType.Reference];
            Debug.Assert(_engineSettings != null,
                         "The settings does not include the reference engine settings.");
            if (_engineSettings == null)
            {
                this.IsInitialized = false;
                return;
            }

            int itemCount = _listGroups.Count;

            for (int i = 0; i < itemCount; i++)
            {
                ReferenceGroup group = _listGroups[i];

                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 indexText = String.Empty;
                if (itemCount > 1)
                {
                    indexText = (i + 1).ToString();
                }

                // Create the build dynamic properties...
                groupContext.CreateProperties(indexText);

                group.BeginSources(context);
            }

            // Turn the link sources to dynamic groups...
            this.CreateLinkGroups(context);

            // Cache the list of applicable formats...
            _listFormats = new BuildFormatList();

            BuildFormatList listFormats = this.Settings.Formats;

            if (listFormats == null || listFormats.Count == 0)
            {
                this.IsInitialized = false;
                return;
            }
            itemCount = listFormats.Count;
            for (int i = 0; i < itemCount; i++)
            {
                BuildFormat format = listFormats[i];
                if (format != null && format.Enabled)
                {
                    _listFormats.Add(format);
                }
            }
            if (_listFormats == null || _listFormats.Count == 0)
            {
                this.IsInitialized = false;
                return;
            }

            // Finally, initialize the build groups...
            itemCount = _listGroups.Count;
            for (int i = 0; i < itemCount; i++)
            {
                ReferenceGroup group = _listGroups[i];

                group.Initialize(context);
                if (!group.IsInitialized)
                {
                    this.IsInitialized = false;
                    break;
                }
            }
        }
        public override void Uninitialize()
        {
            _engineSettings = null;

            base.Uninitialize();
        }