Exemple #1
0
        public Request(string address, RequestConfiguration config = null)
        {
            if (Uri.TryCreate(address, UriKind.Absolute, out Uri uri) == false)
            {
                uri = new Uri(new Uri("http://localhost"), address);
            }

            Address          = uri;
            _configuration   = config ?? new RequestConfiguration();
            _responseHeaders = new Dictionary <string, string>();
        }
 public DownloadConfiguration()
 {
     MaxTryAgainOnFailover = int.MaxValue;               // the maximum number of times to fail.
     ParallelDownload      = false;                      // download parts of file as parallel or not
     ChunkCount            = 1;                          // file parts to download
     Timeout               = 100;                        // timeout (millisecond) per stream block reader
     OnTheFlyDownload      = true;                       // caching in-memory mode
     BufferBlockSize       = 1024;                       // usually, hosts support max to 8000 bytes
     MaximumBytesPerSecond = ThrottledStream.Infinite;   // No-limitation in download speed
     RequestConfiguration  = new RequestConfiguration(); // Default requests configuration
     TempDirectory         = Path.GetTempPath();         // Default chunks path
 }
Exemple #3
0
 public DownloadConfiguration()
 {
     MaxTryAgainOnFailover = int.MaxValue;               // the maximum number of times to fail.
     ParallelDownload      = true;                       // download parts of file as parallel or not
     ChunkCount            = 1;                          // file parts to download
     Timeout               = 1000;                       // timeout (millisecond) per stream block reader
     OnTheFlyDownload      = false;                      // caching in-memory mode
     BufferBlockSize       = 1024 * 1024 * 2;            // usually, hosts support max to 8000 bytes
     MaximumBytesPerSecond = ThrottledStream.Infinite;   // No-limitation in download speed
     RequestConfiguration  = new RequestConfiguration(); // Default requests configuration
     TempDirectory         = "C:\\temp";                 // Default chunks path
     SaveDirectory         = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "downloads");
     RequestConfiguration  = new RequestConfiguration
     {
         Accept                = "*/*",
         UserAgent             = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36",
         ProtocolVersion       = HttpVersion.Version11,
         KeepAlive             = false,
         UseDefaultCredentials = false
     };
 }