/// <summary> /// Creates a new instance of the <see cref="XmlDocCommentReader"/> class /// by searching for a doc comments file that corresponds to the given assembly. /// Searches the given paths, and configures the reader to use a user-defined read policy. /// </summary> /// /// <param name="assembly"> /// The <see cref="System.Reflection.Assembly"/> whose doc comments are retrieved. /// </param> /// /// <param name="settings"> /// The <see cref="XmlDocCommentReaderSettings"/> object containing the doc comment search paths. /// </param> /// /// <param name="createReadPolicy"> /// A factory method that accepts the full path to an XML doc comments file, /// returning a user-defined read policy. /// </param> public XmlDocCommentReader(Assembly assembly, XmlDocCommentReaderSettings settings, CreateReadPolicyDelegate createReadPolicy) { m_settings = settings ?? XmlDocCommentReaderSettings.Default; m_docCommentsFullPath = ResolveDocCommentsLocation(assembly, m_settings.DirectoryNames); m_docCommentsReadPolicy = createReadPolicy(m_docCommentsFullPath); }
/// <summary> /// Creates a new instance of the <see cref="XmlDocCommentReader"/> class /// with a given path to the XML doc comments, and configures the reader /// to use a user-defined read policy. /// </summary> /// /// <param name="docCommentsFullPath"> /// The full path of the XML doc comments. /// </param> /// /// <param name="readPolicy"> /// The doc comment read policy. /// </param> /// /// <remarks> /// Used internally by test code to override file IO operations. /// </remarks> /// /// <exception cref="System.IO.FileNotFoundException"> /// <paramref name="docCommentsFullPath"/> could does not exist or is inaccessible. /// </exception> internal XmlDocCommentReader(string docCommentsFullPath, IXmlDocCommentReadPolicy readPolicy) { if (!File.Exists(docCommentsFullPath)) { throw new FileNotFoundException($"File {docCommentsFullPath} not found", docCommentsFullPath); } m_docCommentsFullPath = docCommentsFullPath; m_docCommentsReadPolicy = readPolicy; m_settings = XmlDocCommentReaderSettings.Default; }