private static string FindXmlDocumentation(string moduleFileName, TargetRuntime runtime)
        {
            switch (runtime)
            {
            case 0:
            {
                V_0 = XmlDocumentationResolver.LookupXmlDoc(Path.Combine(XmlDocumentationResolver.frameworkPath, "v1.0.3705", moduleFileName));
                break;
            }

            case 1:
            {
                V_0 = XmlDocumentationResolver.LookupXmlDoc(Path.Combine(XmlDocumentationResolver.frameworkPath, "v1.1.4322", moduleFileName));
                break;
            }

            case 2:
            {
                stackVariable16 = XmlDocumentationResolver.LookupXmlDoc(Path.Combine(XmlDocumentationResolver.frameworkPath, "v2.0.50727", moduleFileName));
                if (stackVariable16 == null)
                {
                    dummyVar0       = stackVariable16;
                    stackVariable16 = XmlDocumentationResolver.LookupXmlDoc(Path.Combine(XmlDocumentationResolver.referenceAssembliesPath, "v3.5", moduleFileName));
                    if (stackVariable16 == null)
                    {
                        dummyVar1       = stackVariable16;
                        stackVariable16 = XmlDocumentationResolver.LookupXmlDoc(Path.Combine(XmlDocumentationResolver.referenceAssembliesPath, "v3.0\\en", moduleFileName));
                        if (stackVariable16 == null)
                        {
                            dummyVar2       = stackVariable16;
                            stackVariable16 = XmlDocumentationResolver.LookupXmlDoc(Path.Combine(XmlDocumentationResolver.referenceAssembliesPath, ".NETFramework\\v3.5\\Profile\\Client", moduleFileName));
                        }
                    }
                }
                V_0 = stackVariable16;
                break;
            }

            case 3:
            {
                stackVariable33 = XmlDocumentationResolver.LookupXmlDoc(Path.Combine(XmlDocumentationResolver.referenceAssembliesPath, ".NETFramework\\v4.0", moduleFileName));
                if (stackVariable33 == null)
                {
                    dummyVar3       = stackVariable33;
                    stackVariable33 = XmlDocumentationResolver.LookupXmlDoc(Path.Combine(XmlDocumentationResolver.frameworkPath, "v4.0.30319", moduleFileName));
                }
                V_0 = stackVariable33;
                break;
            }

            default:
            {
                V_0 = null;
                break;
            }
            }
            return(V_0);
        }
        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);
        }
 public static bool TryResolveDocumentationLocation(ModuleDefinition module, out string location)
 {
     V_0 = module.get_FilePath();
     V_2 = V_0.Replace(Path.GetExtension(V_0), ".xml");
     if (File.Exists(V_2))
     {
         location = V_2;
         return(true);
     }
     location = XmlDocumentationResolver.FindXmlDocumentation(Path.GetFileName(V_0), module.get_Runtime());
     if (location != null)
     {
         return(true);
     }
     location = String.Empty;
     return(false);
 }
Beispiel #4
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);
        }