internal static void Apply(this ProGetConfiguration config, HttpWebRequest request) { if (!string.IsNullOrWhiteSpace(config.ProGetUser) && !string.IsNullOrWhiteSpace(config.ProGetPassword)) { var encoded = Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes(config.ProGetUser + ":" + config.ProGetPassword)); request.Headers.Add("Authorization", "Basic " + encoded); } if (config.RequestTimeout.HasValue) { request.Timeout = (int)config.RequestTimeout.Value.TotalMilliseconds; } }
internal static void Apply(this ProGetConfiguration config, HttpClient client) { if (!string.IsNullOrWhiteSpace(config.ProGetUser) && !string.IsNullOrWhiteSpace(config.ProGetPassword)) { var authByteArray = Encoding.ASCII.GetBytes($"{config.ProGetUser}:{config.ProGetPassword}"); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(authByteArray)); } if (config.RequestTimeout.HasValue) { client.Timeout = config.RequestTimeout.Value; } }
public static List<ProGetDirectoryListing> ProGetListAssetDirectory(this ICakeContext context, string assetDirectoryUri, ProGetConfiguration config) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } var asset = new ProGetAssetDirectoryLister(config); return asset.ListDirectory(assetDirectoryUri); }
public static void ProGetCreateAssetDirectory(this ICakeContext context, string assetDirectoryUri, ProGetConfiguration config) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } var asset = new ProGetAssetDirectoryLister(config); asset.CreateDirectory(assetDirectoryUri); }
public static void ProGetDownloadAssetDirectory(this ICakeContext context, string assetDirectoryUri, FilePath outputPath, ProGetConfiguration config) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } var asset = new ProGetAssetDownloader(config); asset.GetDirectoryOfAssets(assetDirectoryUri, outputPath); }
public static bool DeleteAsset(this ICakeContext context, string assetUri, ProGetConfiguration config) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } var asset = new ProGetAssetPusher(context.Log, config); return(asset.DeleteAsset(assetUri)); }
public static void ProGetPushAsset(this ICakeContext context, FilePath assetPath, string assetUri, ProGetConfiguration config) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } var asset = new ProGetAssetPusher(context.Log, config); asset.Publish(assetPath, assetUri); }
/// <summary> /// Initializes a new instance of the <see cref="ProGetAssetPusher"/> class. /// </summary> /// <param name="log">The Cake log.</param> /// <param name="configuration">The ProGet Configuration.</param> /// <exception cref="ArgumentNullException">Thrown if environment, log, or config are null.</exception> public ProGetAssetPusher(ICakeLog log, ProGetConfiguration configuration) { _log = log ?? throw new ArgumentNullException(nameof(log)); _configuration = configuration ?? throw new ArgumentException(nameof(configuration)); }
/// <summary> /// Initializes a new instance of the <see cref="ProGetAssetDirectoryLister"/> class. /// </summary> /// <param name="configuration">The ProGet Configuration.</param> /// <exception cref="ArgumentNullException">Thrown if environment, log, or config are null.</exception> public ProGetAssetDirectoryLister(ProGetConfiguration configuration) { _configuration = configuration ?? throw new ArgumentException(nameof(configuration)); }
/// <summary> /// Initializes a new instance of the <see cref="ProGetAssetDownloader"/> class. /// </summary> /// <param name="configuration">The ProGet Configuration.</param> /// <exception cref="ArgumentNullException">Thrown if environment, log, or config are null.</exception> public ProGetAssetDownloader(ProGetConfiguration configuration) { _configuration = configuration ?? throw new ArgumentException(nameof(configuration)); }