Beispiel #1
0
        public override async Task <Tuple <bool, INuGetResource> > TryCreate(SourceRepository sourceRepository, CancellationToken token)
        {
            INuGetResource resource             = null;
            var            serviceIndexResource = await sourceRepository.GetResourceAsync <ServiceIndexResourceV3>();

            var packageBaseAddress = serviceIndexResource?[HttpFileSystemIndexType];

            if (packageBaseAddress != null &&
                packageBaseAddress.Count > 0)
            {
                var httpSourceResource = await sourceRepository.GetResourceAsync <HttpSourceResource>(token);

                resource = new HttpFileSystemBasedFindPackageByIdResource(
                    packageBaseAddress,
                    httpSourceResource.HttpSource);
            }

            return(Tuple.Create(resource != null, resource));
        }
        public override async Task <Tuple <bool, INuGetResource> > TryCreate(SourceRepository sourceRepository, CancellationToken token)
        {
            INuGetResource resource             = null;
            var            serviceIndexResource = await sourceRepository.GetResourceAsync <ServiceIndexResourceV3>();

            var packageBaseAddress = serviceIndexResource?.GetServiceEntryUris(ServiceTypes.PackageBaseAddress);

            if (packageBaseAddress != null &&
                packageBaseAddress.Count > 0)
            {
                //Repository signature information init
                var repositorySignatureResource = await sourceRepository.GetResourceAsync <RepositorySignatureResource>(token);

                repositorySignatureResource?.UpdateRepositorySignatureInfo();

                var httpSourceResource = await sourceRepository.GetResourceAsync <HttpSourceResource>(token);

                resource = new HttpFileSystemBasedFindPackageByIdResource(
                    packageBaseAddress,
                    httpSourceResource.HttpSource);
            }

            return(Tuple.Create(resource != null, resource));
        }