private static DocumentationCache GetDocumentationCache(ModuleDefinition module)
        {
            if (DocumentationManager.IsCachedModule(module))
            {
                return(DocumentationManager.cachedDocumentation);
            }
            V_0 = DocumentationManager.locker;
            V_1 = false;
            try
            {
                Monitor.Enter(V_0, ref V_1);
                if (!DocumentationManager.IsCachedModule(module))
                {
                    if (!XmlDocumentationResolver.TryResolveDocumentationLocation(module, out V_2))
                    {
                        DocumentationManager.cachedDocumentation = null;
                        DocumentationManager.cachedXmlFile       = null;
                    }
                    else
                    {
                        if (!String.op_Inequality(DocumentationManager.cachedXmlFile, V_2))
                        {
                            V_3 = DocumentationManager.cachedDocumentation;
                            goto Label1;
                        }
                        else
                        {
                            DocumentationManager.cachedDocumentation = DocumentationManager.ReadDocumentation(V_2);
                            DocumentationManager.cachedXmlFile       = V_2;
                        }
                    }
                    DocumentationManager.CacheModule(module);
                    goto Label0;
                }
                else
                {
                    V_3 = DocumentationManager.cachedDocumentation;
                }
            }
            finally
            {
                if (V_1)
                {
                    Monitor.Exit(V_0);
                }
            }
Label1:
            return(V_3);

Label0:
            return(DocumentationManager.cachedDocumentation);
        }
Exemple #2
0
        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);
        }