Ejemplo n.º 1
0
        internal static SnapNugetFeed BuildSnapNugetFeed([NotNull] this PackageSource packageSource, [NotNull] INuGetPackageSources nuGetPackageSources)
        {
            if (packageSource == null)
            {
                throw new ArgumentNullException(nameof(packageSource));
            }
            if (nuGetPackageSources == null)
            {
                throw new ArgumentNullException(nameof(nuGetPackageSources));
            }

            var apiKey = packageSource.GetDecryptedValue(nuGetPackageSources, ConfigurationConstants.ApiKeys);

            var snapFeed = new SnapNugetFeed
            {
                Name            = packageSource.Name,
                Source          = packageSource.SourceUri,
                ProtocolVersion = (NuGetProtocolVersion)packageSource.ProtocolVersion,
                Username        = packageSource.Credentials?.Username,
                Password        = packageSource.Credentials?.Password,
                ApiKey          = apiKey
            };

            return(snapFeed);
        }