public DownloadMessage(Uri uri, string targetPath, E_FileDisposition enumDisposition = E_FileDisposition.OverwriteAlways, int htmlDepth = 0) { ID = unchecked (Interlocked.Increment(ref RequestID)); DownloadUri = uri ?? throw new NullReferenceException("DownloadMessage requires non-null Uri"); // assume caller has lowercased strings Url = DownloadUri.ToString(); // set alternate format as 1-off var segs = uri.Segments; // split the url (except querystring) TargetPath = (string.IsNullOrWhiteSpace(Path.GetFileNameWithoutExtension(targetPath))) ? Path.Combine(targetPath, segs[segs.Length - 1] + ".html") // default filename to final segment of Url : targetPath; EnumDisposition = enumDisposition; HtmlDepth = htmlDepth; }
public DownloadMessage(string downloadUrl, string targetPath, E_FileDisposition enumDisposition = E_FileDisposition.OverwriteAlways, int htmlDepth = 0) : this(new Uri(downloadUrl.ToLower()), targetPath, enumDisposition, htmlDepth) { }