public void SetDownloadInfo(SingleSourceHTTPDownloadInfo info) { this.state !.Url = new Uri(info.Uri); this.state.Cookies = info.Cookies; this.state.Headers = info.Headers; this.SaveState(); }
public SingleSourceHTTPDownloader(SingleSourceHTTPDownloadInfo info, IHttpClient?hc = null, AuthenticationInfo?authentication = null, ProxyInfo?proxy = null, BaseMediaProcessor mediaProcessor = null, bool convertToMp3 = false) { Id = Guid.NewGuid().ToString(); this.state = new SingleSourceHTTPDownloaderState { Url = new Uri(info.Uri), Id = this.Id, Cookies = info.Cookies, Headers = info.Headers, TempDir = Path.Combine(Config.Instance.TempDir, Id), Authentication = authentication, Proxy = proxy, ConvertToMp3 = convertToMp3 }; if (this.state.Headers == null) { this.CreateDefaultHeaders(); } if (this.state.Authentication == null) { this.state.Authentication = Helpers.GetAuthenticationInfoFromConfig(this.state.Url); } this.TargetFileName = FileHelper.SanitizeFileName(info.File); this.http = hc; this.mediaProcessor = mediaProcessor; }