public override async Task <Tuple <bool, INuGetResource> > TryCreate( SourceRepository source, CancellationToken token) { ListResource resource = null; var serviceIndex = await source.GetResourceAsync <ServiceIndexResourceV3>(token); if (serviceIndex != null) { var baseUrl = serviceIndex.GetServiceEntryUri(ServiceTypes.LegacyGallery); if (baseUrl != null) { var httpSource = await source.GetResourceAsync <HttpSourceResource>(token); var serviceDocument = await ODataServiceDocumentUtils.CreateODataServiceDocumentResourceV2( baseUrl.AbsoluteUri, httpSource.HttpSource, DateTime.UtcNow, NullLogger.Instance, token); var parser = new V2FeedParser(httpSource.HttpSource, serviceDocument.BaseAddress, source.PackageSource.Source); var feedCapabilityResource = new LegacyFeedCapabilityResourceV2Feed(parser, serviceDocument.BaseAddress); resource = new V2FeedListResource(parser, feedCapabilityResource, serviceDocument.BaseAddress); } } var result = new Tuple <bool, INuGetResource>(resource != null, resource); return(result); }
public override async Task <Tuple <bool, INuGetResource> > TryCreate(SourceRepository source, CancellationToken token) { ListResource resource = null; if (await source.GetFeedType(token) == FeedType.HttpV2) { var httpSource = await source.GetResourceAsync <HttpSourceResource>(token); var serviceDocument = await source.GetResourceAsync <ODataServiceDocumentResourceV2>(token); if (serviceDocument != null) { var parser = new V2FeedParser(httpSource.HttpSource, serviceDocument.BaseAddress, source.PackageSource.Source); var feedCapabilityResource = new LegacyFeedCapabilityResourceV2Feed(parser, serviceDocument.BaseAddress); resource = new V2FeedListResource(parser, feedCapabilityResource, serviceDocument.BaseAddress); } } return(new Tuple <bool, INuGetResource>(resource != null, resource)); }