src/Microsoft.PackageManagement.NuGetProvider/NugetLightClient.cs
/// <summary>
/// Download data from remote via uri query.
/// </summary>
/// <param name="query">Uri query</param>
/// <param name="request">An object passed in from the PackageManagement platform that contains APIs that can be used to interact with it </param>
/// <returns></returns>
Download data from remote via uri query.
Download data from remote via uri query .
internal static Stream DownloadDataToStream(string query, NuGetRequest request)
        {
            request.Debug(Messages.DownloadingPackage, query);
            var client = request.Client;
            var response = PathUtility.GetHttpResponse(client, query, (()=>request.IsCanceled),
                ((msg, num) => request.Verbose(Resources.Messages.RetryingDownload, msg, num)), (msg)=>request.Verbose(msg), (msg)=>request.Debug(msg));
            if (response == null || !response.IsSuccessStatusCode)
            {
                request.Warning(Resources.Messages.CouldNotGetResponseFromQuery, query);
                return null;
            }
            var stream = GetStreamBasedOnEncoding(response);
            request.Debug(Messages.CompletedDownload, query);
            return stream;
        }
internal static Stream DownloadDataToStream ( string query , NuGetRequest request ) { request . Debug ( Messages . DownloadingPackage , query ) ; var client = request . Client ; var response = PathUtility . GetHttpResponse ( client , query , ( ( ) => request . IsCanceled ) , ( ( msg , num ) => request . Verbose ( Resources . Messages . RetryingDownload , msg , num ) ) , ( msg ) => request . Verbose ( msg ) , ( msg ) => request . Debug ( msg ) ) ; if ( response == null || ! response . IsSuccessStatusCode ) { request . Warning ( Resources . Messages . CouldNotGetResponseFromQuery , query ) ; return null ; } var stream = GetStreamBasedOnEncoding ( response ) ; request . Debug ( Messages . CompletedDownload , query ) ; return stream ; }
Download data from remote via uri query.
Download data from remote via uri query .
// Check that response was successful or throw exception // Read response and write out a stream
None
query
string
None
request
NuGetRequest
An object passed in from the PackageManagement platform that contains APIs that can be used to interact with it
An object passed in from the PackageManagement platform that contains APIs that can be used to interact with it