private static string GetXmlDocumentationPath(dynamic assembly) { var assemblyName = assembly.GetName(); var path = FullDotNetMethods.PathCombine(FullDotNetMethods.PathGetDirectoryName(assembly.Location), assemblyName.Name + ".xml"); if (FullDotNetMethods.FileExists(path)) { return(path); } dynamic currentDomain = Type.GetType("System.AppDomain").GetRuntimeProperty("CurrentDomain").GetValue(null); path = FullDotNetMethods.PathCombine(currentDomain.BaseDirectory, assemblyName.Name + ".xml"); if (FullDotNetMethods.FileExists(path)) { return(path); } return(FullDotNetMethods.PathCombine(currentDomain.BaseDirectory, "bin\\" + assemblyName.Name + ".xml")); }
/// <summary>Returns the contents of the "summary" XML documentation tag for the specified member.</summary> /// <param name="member">The reflected member.</param> /// <param name="pathToXmlFile">The path to the XML documentation file.</param> /// <returns>The contents of the "summary" tag for the member.</returns> public static string GetXmlDocumentation(this MemberInfo member, string pathToXmlFile) { try { lock (_lock) { if (pathToXmlFile == null || FullDotNetMethods.SupportsFullDotNetMethods == false) { return(string.Empty); } var assemblyName = member.Module.Assembly.GetName(); if (_cache.ContainsKey(assemblyName.FullName) && _cache[assemblyName.FullName] == null) { return(string.Empty); } if (!FullDotNetMethods.FileExists(pathToXmlFile)) { _cache[assemblyName.FullName] = null; return(string.Empty); } if (!_cache.ContainsKey(assemblyName.FullName)) { _cache[assemblyName.FullName] = XDocument.Load(pathToXmlFile); } return(GetXmlDocumentation(member, _cache[assemblyName.FullName])); } } catch { return(string.Empty); } }