public GetStringAsync ( |
||
address | ||
token | ||
return | Task |
public virtual Task<string> GetStringAsync(Uri address, CancellationToken token)
{
var task = GetAsync(address, token);
return task.ContinueWith((t) =>
{
try
{
return task.Result.Content.ReadAsStringAsync().Result;
}
catch (Exception e)
{
throw new Exception(string.Format("GetStringAsync({0})", address), e);
}
}, token);
}
}
/// <summary> /// Sets the service endpoint property values to the ones defined in the specified service index. /// </summary> /// <param name="serviceIndexUrl">The service index endpoint which contains the endpoints of the NuGet services.</param> private async Task InitializeAsync(Uri serviceIndexUrl) { ServiceIndex serviceIndex; using (CollectorHttpClient client = new CollectorHttpClient()) { string serviceIndexText = await client.GetStringAsync(serviceIndexUrl); serviceIndex = ServiceIndex.Deserialize(serviceIndexText); } Uri registrationBaseUrl; if (!serviceIndex.TryGetResourceId("RegistrationsBaseUrl", out registrationBaseUrl)) { throw new ArgumentOutOfRangeException("serviceIndexAddress", "The service index does not contain a RegistrationBaseUrl entry."); } this.RegistrationBaseUrl = registrationBaseUrl; this.ServiceIndexUrl = serviceIndexUrl; }