NuGet.SettingsCredentialProvider.TryGetCredentials C# (CSharp) Méthode

TryGetCredentials() private méthode

private TryGetCredentials ( Uri uri, NetworkCredential &configurationCredentials ) : bool
uri System.Uri
configurationCredentials System.Net.NetworkCredential
Résultat bool
        private bool TryGetCredentials(Uri uri, out NetworkCredential configurationCredentials)
        {
            var source = _packageSourceProvider.LoadPackageSources().FirstOrDefault(p =>
            {
                Uri sourceUri;
                return !String.IsNullOrEmpty(p.UserName) 
                    && !String.IsNullOrEmpty(p.Password) 
                    && Uri.TryCreate(p.Source, UriKind.Absolute, out sourceUri) 
                    && UriUtility.UriEquals(sourceUri, uri);
            });
            if (source == null)
            {
                // The source is not in the config file
                configurationCredentials = null;
                return false;
            }
            configurationCredentials = new NetworkCredential(source.UserName, source.Password);
            return true;
        }
    }