private async Task <string> DownloadReleaseNotes(string link, CancellationToken cancellationToken) { try { using (var webClient = new WebClient()) { webClient.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials; webClient.Encoding = Encoding.UTF8; if (cancellationToken != null) { using (cancellationToken.Register(() => webClient.CancelAsync())) { return(await webClient.DownloadStringTaskAsync(_sparkle.GetAbsoluteUrl(link))); } } return(await webClient.DownloadStringTaskAsync(_sparkle.GetAbsoluteUrl(link))); } } catch (WebException ex) { _sparkle.LogWriter.PrintMessage("Cannot download release notes from {0} because {1}", link, ex.Message); return(""); } }
private string DownloadReleaseNotes(string link) { try { using (var webClient = new WebClient()) { webClient.Proxy.Credentials = CredentialCache.DefaultNetworkCredentials; webClient.Encoding = Encoding.UTF8; return(webClient.DownloadString(_sparkle.GetAbsoluteUrl(link))); } } catch (WebException ex) { Debug.WriteLine("Cannot download release notes from " + link + " because " + ex.Message); return(""); } }