/// <summary>
        /// Locates the XML doc comment file corresponding to the given
        /// <see cref="System.Reflection.Assembly"/>, in the given directories.
        /// </summary>
        ///
        /// <param name="assembly">
        /// The assembly whose doc comments are retrieved.
        /// </param>
        ///
        /// <param name="directories">
        /// The directory names to search.
        /// </param>
        ///
        /// <returns>
        /// The full path to the requested XML doc comment file, if it exists.
        /// </returns>
        ///
        /// <exception cref="System.IO.FileNotFoundException">
        /// The XML doc comments file was not found, for the given set of parameters.
        /// </exception>
        private static string ResolveDocCommentsLocation(Assembly assembly, XmlDocCommentDirectoryElementCollection directories)
        {
            string assemblyFileName       = assembly.GetName().Name;
            string xmlDocCommentsFilename = String.Concat(assemblyFileName, XmlFileExtension);

            foreach (XmlDocCommentDirectoryElement directory in directories)
            {
                string xmlDocCommentsFullPath = Path.GetFullPath(Path.Combine(directory.Name, xmlDocCommentsFilename));
                if (File.Exists(xmlDocCommentsFullPath))
                {
                    return(xmlDocCommentsFullPath);
                }
            }

            throw new FileNotFoundException($"Assembly {assemblyFileName} not found", assemblyFileName);
        }
Beispiel #2
0
 /// <summary>
 /// Creates a new instance of the <see cref="XmlDocCommentReaderSettings"/> class
 /// with the given directory names.
 /// </summary>
 ///
 /// <param name="docCommentDirectoryNames">
 /// The search paths used to locate an XML doc comments file.
 /// </param>
 public XmlDocCommentReaderSettings(IEnumerable <string> docCommentDirectoryNames)
 {
     this["XmlDocCommentDirectories"] = new XmlDocCommentDirectoryElementCollection(docCommentDirectoryNames);
 }