public FeedVerificationResult VerifyFeed(string source, bool authenticateIfRequired = true)
{
var result = FeedVerificationResult.Valid;
Log.Debug("Verifying feed '{0}'", source);
using (ScopeManager<AuthenticationScope>.GetScopeManager(source.GetSafeScopeName(), () => new AuthenticationScope(authenticateIfRequired)))
{
try
{
var repository = _packageRepositoryFactory.CreateRepository(source);
var anyExists = repository.GetPackages().Take(1).Count();
}
catch (WebException ex)
{
result = HandleWebException(ex, source);
}
catch (UriFormatException ex)
{
Log.Debug(ex, "Failed to verify feed '{0}', a UriFormatException occurred", source);
result = FeedVerificationResult.Invalid;
}
catch (Exception ex)
{
Log.Debug(ex, "Failed to verify feed '{0}'", source);
result = FeedVerificationResult.Invalid;
}
}
Log.Debug("Verified feed '{0}', result is '{1}'", source, result);
return result;
}