public virtual string DownloadString(DownloadEntry entry) { ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCallback; using (WebClient client = new WebClient()) { client.Credentials = Credentials; try { return(Encoding.UTF8.GetString(client.DownloadData(entry.RemoteUrl))); } catch (WebException webException) { throw new WebException($"The URL {entry.RemoteUrl} generated an exception.", webException); } } }
public virtual T DownloadJson <T>(DownloadEntry entry, ISerializer serializer) { var content = DownloadString(entry); return(serializer.Deserialize <T>(content)); }