private static DocumentationCache GetDocumentationCache(ModuleDefinition module) { if (IsCachedModule(module)) { return cachedDocumentation; } lock (locker) { if (IsCachedModule(module)) { return cachedDocumentation; } string filePath; bool hasDocumentation = XmlDocumentationResolver.TryResolveDocumentationLocation(module, out filePath); if (hasDocumentation) { if (cachedXmlFile != filePath) { cachedDocumentation = ReadDocumentation(filePath); cachedXmlFile = filePath; } else { // This can be the case if two different assemblies share the same documentation file and are decompiled in sequence. // For instance PresentationFramework.dll form 32 and 64 bit .NET folders. return cachedDocumentation; } } else { cachedDocumentation = null; cachedXmlFile = null; } CacheModule(module); } return cachedDocumentation; }
private static DocumentationCache ReadDocumentation(string documentationLocation) { XmlDocumentationReader reader = new XmlDocumentationReader(); Dictionary<string, string> map = reader.ReadDocumentation(documentationLocation); DocumentationCache documentation = new DocumentationCache(map, documentationLocation); return documentation; }