コード例 #1
0
            protected override DocumentationProvider CreateDocumentationProvider()
            {
                string xmlDocumentPath;

                if (ReferencePathUtilities.TryFindXmlDocumentationFile(FilePath, out xmlDocumentPath))
                {
                    return(new VisualStudioDocumentationProvider(xmlDocumentPath, _provider.XmlMemberIndexService));
                }
                else
                {
                    return(DocumentationProvider.Default);
                }
            }
コード例 #2
0
        private CacheEntry <MetadataShadowCopy> CreateMetadataShadowCopy(string originalPath, MetadataImageKind kind)
        {
            int attempts = 10;

            while (true)
            {
                try
                {
                    if (ShadowCopyDirectory == null)
                    {
                        ShadowCopyDirectory = CreateUniqueDirectory(_baseDirectory);
                    }

                    // Create directory for the assembly.
                    // If the assembly has any modules they have to be copied to the same directory
                    // and have the same names as specified in metadata.
                    string assemblyDir    = CreateUniqueDirectory(ShadowCopyDirectory);
                    string shadowCopyPath = Path.Combine(assemblyDir, Path.GetFileName(originalPath));

                    ShadowCopy documentationFileCopy = null;
                    string     xmlOriginalPath;
                    if (ReferencePathUtilities.TryFindXmlDocumentationFile(originalPath, out xmlOriginalPath))
                    {
                        // TODO (tomat): how do doc comments work for multi-module assembly?
                        var xmlCopyPath = Path.ChangeExtension(shadowCopyPath, ".xml");
                        var xmlStream   = CopyFile(xmlOriginalPath, xmlCopyPath, fileMayNotExist: true);
                        if (xmlStream != null)
                        {
                            documentationFileCopy = new ShadowCopy(xmlStream, xmlOriginalPath, xmlCopyPath);
                        }
                    }

                    var manifestModuleCopyStream = CopyFile(originalPath, shadowCopyPath);
                    var manifestModuleCopy       = new ShadowCopy(manifestModuleCopyStream, originalPath, shadowCopyPath);

                    Metadata privateMetadata;
                    if (kind == MetadataImageKind.Assembly)
                    {
                        privateMetadata = CreateAssemblyMetadata(manifestModuleCopyStream, originalPath, shadowCopyPath);
                    }
                    else
                    {
                        privateMetadata = CreateModuleMetadata(manifestModuleCopyStream);
                    }

                    var publicMetadata = privateMetadata.Copy();
                    return(new CacheEntry <MetadataShadowCopy>(new MetadataShadowCopy(manifestModuleCopy, documentationFileCopy, publicMetadata), privateMetadata));
                }
                catch (DirectoryNotFoundException)
                {
                    // the shadow copy directory has been deleted - try to copy all files again
                    if (!Directory.Exists(ShadowCopyDirectory))
                    {
                        ShadowCopyDirectory = null;
                        if (attempts-- > 0)
                        {
                            continue;
                        }
                    }

                    throw;
                }
            }
        }