private void LoadConfiguration(string configFile, bool includeInternalMembers) { // load the configuration file XPathDocument config; string configDirectory = Path.GetDirectoryName(configFile); try { config = new XPathDocument(configFile); } catch (IOException e) { throw new SandcastleBuildException(e, "An error occured while attempting to read the configuration file '{0}'", configFile); } catch (UnauthorizedAccessException e) { throw new SandcastleBuildException(e, "An error occured while attempting to read the configuration file '{0}'", configFile); } catch (XmlException e) { throw new SandcastleBuildException(e, "The configuration file '{0}' is not well-formed.", configFile); } ConfigurationContext configContext = new ConfigurationContext(); configContext.ConfigurationFile = configFile; configContext.Configuration = config; // adjust the target platform XPathNodeIterator platformNodes = config.CreateNavigator().Select("/configuration/dduetools/platform"); if (platformNodes.MoveNext()) { XPathNavigator platformNode = platformNodes.Current; string version = platformNode.GetAttribute("version", String.Empty); string path = platformNode.GetAttribute("path", String.Empty); path = Environment.ExpandEnvironmentVariables(path); if (!Directory.Exists(path)) { throw new SandcastleBuildException("The specifed target platform directory '{0}' does not exist. Specifie platform version '{1}'.", path, version); } if (version == "2.0") { TargetPlatform.SetToV2(path); } else if (version == "1.1") { TargetPlatform.SetToV1_1(path); } else if (version == "1.0") { TargetPlatform.SetToV1(path); } else { throw new SandcastleBuildException(null, "The specifed target platform '{0}' is not supported.", version); } this.FrameworkName = new FrameworkName(".NET Framework, Version=" + version); } // create a namer ApiNamer namer = TypeLoader.CreateType <ApiNamer>(configContext, "/configuration/dduetools/namer", () => new OrcasNamer()); // create a resolver AssemblyResolver resolver = TypeLoader.CreateType <AssemblyResolver>(configContext, "/configuration/dduetools/resolver", () => new AssemblyResolver()); XPathNodeIterator addinNodes = config.CreateNavigator().Select("/configuration/dduetools/addins/addin"); foreach (XPathNavigator addinNode in addinNodes) { MRefBuilderAddIn addin = TypeLoader.CreateType <MRefBuilderAddIn>(addinNode, configDirectory, addinNode); if (addin != null) { this.BuilderAddins.Add(addin); } } XPathNavigator filterConfig = config.CreateNavigator().SelectSingleNode("/configuration/dduetools"); if (includeInternalMembers) { this.ApiFilter = new AllDocumentedFilter(filterConfig); } else { this.ApiFilter = new ExternalDocumentedFilter(filterConfig); } this.ApiNamer = namer; this.Resolver = resolver; }