예제 #1
0
        private IEnumerable <(DocumentHandle DocumentHandle, SourceTextInfo SourceTextInfo)> GetSourceTextInfoCore()
        {
            var encoding        = GetEncoding();
            var sourceFileCount = GetSourceFileCount();

            foreach (var documentHandle in PdbReader.Documents.Take(sourceFileCount))
            {
                var document = PdbReader.GetDocument(documentHandle);
                var name     = PdbReader.GetString(document.Name);

                var hashAlgorithmGuid = PdbReader.GetGuid(document.HashAlgorithm);
                var hashAlgorithm     =
                    hashAlgorithmGuid == HashAlgorithmSha1
                        ? SourceHashAlgorithm.Sha1
                        : hashAlgorithmGuid == HashAlgorithmSha256
                            ? SourceHashAlgorithm.Sha256
                            : SourceHashAlgorithm.None;

                var hash           = PdbReader.GetBlobBytes(document.Hash);
                var sourceTextInfo = new SourceTextInfo(
                    name,
                    hashAlgorithm,
                    hash.ToImmutableArray(),
                    encoding
                    );
                yield return(documentHandle, sourceTextInfo);
            }
        }