public IPackageRepository FromUserInput(string userInput, NetworkCredential credentials = null) { bool found = false; var targetUri = userInput.ToUri(); if (targetUri == null || targetUri.IsAbsoluteUri == false || !(targetUri.Scheme.EqualsNoCase("http") || targetUri.Scheme.EqualsNoCase("https"))) { return(null); } if (!targetUri.Segments.Last().EqualsNoCase("index.wraplist")) { targetUri = targetUri.EnsureTrailingSlash().Combine("index.wraplist"); } _client.Head(targetUri) .Credentials(credentials) .Handle(200, _ => found = true) .Send(); var repository = GetIndexedRepository(targetUri); if (credentials != null) { repository = new PreAuthenticatedRepository(repository, repository.Feature <ISupportAuthentication>(), credentials); } return(found ? repository : null); }
public IPackageRepository FromUserInput(string userInput, NetworkCredential credentials = null) { bool found = false; var targetUri = userInput.ToUri(); if (targetUri == null || targetUri.IsAbsoluteUri == false || !(targetUri.Scheme.EqualsNoCase("http") || targetUri.Scheme.EqualsNoCase("https"))) return null; if (!targetUri.Segments.Last().EqualsNoCase("index.wraplist")) targetUri = targetUri.EnsureTrailingSlash().Combine("index.wraplist"); _client.Head(targetUri) .Credentials(credentials) .Handle(200, _ => found = true) .Send(); var repository = GetIndexedRepository(targetUri); if (credentials != null) repository = new PreAuthenticatedRepository(repository, repository.Feature<ISupportAuthentication>(), credentials); return found ? repository : null; }