/// <summary>
 /// Gets the newest download informations in case of url expired or remote file was modified
 /// </summary>
 /// <returns></returns>
 public HttpDownloadInfo GetCurrentInformations()
 {
     try
     {
         var req = HttpRequestHelper.CreateHttpRequest(this.Url, null, true);
         cd_BeforeSendingRequest(this, new BeforeSendingRequestEventArgs(req));
         using (var resp = (HttpWebResponse)req.GetResponse())
         {
             return(HttpDownloadInfo.GetFromResponse(resp, this.Url));
         }
     }
     catch
     {
         return(null);
     }
 }
        private void cd_ResponseReceived(object sender, ResponseReceivedEventArgs e)
        {
            var cd = (HttpRangeDownloader)sender;

            if (Info == null)
            {
                Info     = HttpDownloadInfo.GetFromResponse(e.Response, Url);
                LastInfo = Info.Clone();
                cd.Info  = Info.Clone();
                cd.Wait  = Info.AcceptRanges;
                var chunkedHeader = e.Response.Headers[HttpResponseHeader.TransferEncoding];
                UseChunk = Info.AcceptRanges && chunkedHeader != null && chunkedHeader.ToLower() == "chunked";
                Ranges.First().End = Info.ContentSize - 1;
                //NofThread = Info.AcceptRanges ? NofThread : 1;
                DownloadInfoReceived.Raise(this, EventArgs.Empty);
            }
            if (NofActiveThreads > 1 && Info.AcceptRanges && Info.ResumeCapability != Resumeability.Yes)
            {
                Info.ResumeCapability = Resumeability.Yes;
                foreach (var a in cdList)
                {
                    Info.AcceptRanges   = true;
                    a.Info.AcceptRanges = true;
                }
                foreach (var item in cdList.Where(x => x.Wait))
                {
                    item.Wait = false;
                }
            }
            if (Info.ContentSize < 10 * 1024 + 1)
            {
                foreach (var item in cdList.Where(x => x.Wait))
                {
                    item.Wait = false;
                }
            }
            createNewThreadIfRequired();
        }
 internal HttpRangeDownloader(HttpRange range, HttpDownloadInfo info = null)
 {
     Range    = range;
     Info     = info;
     UseChunk = true;
 }