Exemplo n.º 1
0
        public async Task <Stream> GetPackageIconStreamOrNullAsync(string id, NuGetVersion version, CancellationToken cancellationToken = default)
        {
            var package = await _packages.FindPackageOrNullAsync(id, version, cancellationToken);

            if (package == null || !package.HasEmbeddedIcon)
            {
                return(null);
            }

            return(await _storage.GetIconStreamAsync(id, version, cancellationToken));
        }
Exemplo n.º 2
0
        public async Task <Stream> GetPackageIconStreamOrNullAsync(string id, NuGetVersion version, CancellationToken cancellationToken = default)
        {
            // Allow read-through caching if it is configured.
            await _mirror.MirrorAsync(id, version, cancellationToken);

            var package = await _packages.FindOrNullAsync(id, version, includeUnlisted : true, cancellationToken);

            if (!package.HasEmbeddedIcon)
            {
                return(null);
            }

            return(await _storage.GetIconStreamAsync(id, version, cancellationToken));
        }