/// <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 override void OnReadXml(XmlReader reader)
        {
            if (reader.IsEmptyElement)
            {
                return;
            }

            string startElement = reader.Name;

            if (String.Equals(startElement, ReferenceSource.TagName,
                              StringComparison.OrdinalIgnoreCase))
            {
                string sourceName = reader.GetAttribute("name");

                // For the link source...
                if (String.Equals(sourceName, ReferenceLinkSource.SourceName,
                                  StringComparison.OrdinalIgnoreCase))
                {
                    if (_topicLinks == null)
                    {
                        _topicLinks = new BuildList <ReferenceLinkSource>();
                    }
                    ReferenceLinkSource linkSource = new ReferenceLinkSource();
                    linkSource.ReadXml(reader);

                    _topicLinks.Add(linkSource);
                }
            }
            else if (String.Equals(startElement, "propertyGroup",
                                   StringComparison.OrdinalIgnoreCase))
            {
                Debug.Assert(String.Equals(reader.GetAttribute("name"), "General"));

                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        if (String.Equals(reader.Name, "property", StringComparison.OrdinalIgnoreCase))
                        {
                            string tempText = null;
                            switch (reader.GetAttribute("name").ToLower())
                            {
                            case "namer":
                                tempText = reader.ReadString();
                                if (!String.IsNullOrEmpty(tempText))
                                {
                                    _refNamer = (ReferenceNamer)Enum.Parse(
                                        typeof(ReferenceNamer), tempText, true);
                                }
                                break;

                            case "naming":
                                tempText = reader.ReadString();
                                if (!String.IsNullOrEmpty(tempText))
                                {
                                    _refNaming = (ReferenceNamingMethod)Enum.Parse(
                                        typeof(ReferenceNamingMethod), tempText, true);
                                }
                                break;

                            case "rootnamespacecontainer":
                                tempText = reader.ReadString();
                                if (!String.IsNullOrEmpty(tempText))
                                {
                                    _rootContainer = Convert.ToBoolean(tempText);
                                }
                                break;

                            case "embedscriptsharpframework":
                                tempText = reader.ReadString();
                                if (!String.IsNullOrEmpty(tempText))
                                {
                                    _embedScriptSharp = Convert.ToBoolean(tempText);
                                }
                                break;

                            case "webmvcsdktype":
                                tempText = reader.ReadString();
                                if (!String.IsNullOrEmpty(tempText))
                                {
                                    _webMvcSdkType = BuildSpecialSdkType.Parse(tempText);
                                }
                                break;

                            default:
                                // Should normally not reach here...
                                throw new NotImplementedException(reader.GetAttribute("name"));
                            }
                        }
                    }
                    else if (reader.NodeType == XmlNodeType.EndElement)
                    {
                        if (String.Equals(reader.Name, startElement,
                                          StringComparison.OrdinalIgnoreCase))
                        {
                            break;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ReferenceEngineSettings"/> class
        /// with the default parameters.
        /// </summary>
        public ReferenceEngineSettings()
            : base("Sandcastle.References.ReferenceEngineSettings", BuildEngineType.Reference)
        {
            _webMvcSdkType                  = BuildSpecialSdkType.Null;
            _rootContainer                  = false;
            _embedScriptSharp               = true;
            _includeAllMembersTopic         = true;
            _includeInheritedOverloadTopics = true;
            _refNamer  = ReferenceNamer.Orcas;
            _refNaming = ReferenceNamingMethod.Guid;

            IBuildNamedList <BuildConfiguration> configurations = this.Configurations;

            if (configurations != null)
            {
                // For the ReferenceVisitors...
                ReferenceCommentConfiguration comments =
                    new ReferenceCommentConfiguration();

                ReferenceSpellCheckConfiguration spellCheck =
                    new ReferenceSpellCheckConfiguration();

                ReferenceVisibilityConfiguration documentVisibility =
                    new ReferenceVisibilityConfiguration();

                ReferenceXPathConfiguration pathDocumentVisibility =
                    new ReferenceXPathConfiguration();
                pathDocumentVisibility.Enabled = false;

                // For the ReferenceTocVistors...
                ReferenceTocExcludeConfiguration excludeToc =
                    new ReferenceTocExcludeConfiguration();
                ReferenceTocLayoutConfiguration layoutToc =
                    new ReferenceTocLayoutConfiguration();

                configurations.Add(comments);
                configurations.Add(documentVisibility);
                configurations.Add(pathDocumentVisibility);
                configurations.Add(spellCheck);

                configurations.Add(excludeToc);
                configurations.Add(layoutToc);
            }

            IBuildNamedList <BuildComponentConfiguration> componentConfigurations
                = this.ComponentConfigurations;

            if (componentConfigurations != null)
            {
                ReferencePreTransConfiguration preTrans =
                    new ReferencePreTransConfiguration();

                ReferenceMissingTagsConfiguration missingTags =
                    new ReferenceMissingTagsConfiguration();

                ReferenceAutoDocConfiguration autoDocument =
                    new ReferenceAutoDocConfiguration();

                ReferenceIntelliSenseConfiguration intelliSense =
                    new ReferenceIntelliSenseConfiguration();

                ReferencePlatformsConfiguration platforms =
                    new ReferencePlatformsConfiguration();

                ReferenceCloneConfiguration cloneDocument =
                    new ReferenceCloneConfiguration();

                ReferencePostTransConfiguration postTrans =
                    new ReferencePostTransConfiguration();

                ReferenceCodeConfiguration codeComponent =
                    new ReferenceCodeConfiguration();

                ReferenceMathConfiguration mathComponent =
                    new ReferenceMathConfiguration();

                ReferenceMediaConfiguration mediaComponent =
                    new ReferenceMediaConfiguration();

                ReferenceLinkConfiguration linkComponent =
                    new ReferenceLinkConfiguration();

                ReferenceSharedConfiguration sharedComponent =
                    new ReferenceSharedConfiguration();

                componentConfigurations.Add(preTrans);
                componentConfigurations.Add(autoDocument);
                componentConfigurations.Add(missingTags);
                componentConfigurations.Add(intelliSense);
                componentConfigurations.Add(platforms);
                componentConfigurations.Add(cloneDocument);
                componentConfigurations.Add(postTrans);
                componentConfigurations.Add(codeComponent);
                componentConfigurations.Add(mathComponent);
                componentConfigurations.Add(mediaComponent);
                componentConfigurations.Add(linkComponent);
                componentConfigurations.Add(sharedComponent);
            }
        }