Пример #1
0
 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);
         }
     }
 }
Пример #2
0
        public virtual T DownloadJson <T>(DownloadEntry entry, ISerializer serializer)
        {
            var content = DownloadString(entry);

            return(serializer.Deserialize <T>(content));
        }