public DownloadSource(FileTask OfTask, string URL) { this.OfTask = OfTask; this.URL = URL; wc = new WebDownload(); wc.DownloadProgressChanged += (s, e) => { lock (this) Downloaded = e.BytesReceived; }; wc.DownloadDataCompleted += Wc_DownloadDataCompleted; Wc_DownloadDataCompleted(null, null); }
public override List <Block> GetBlockList(FileTask OfTask) { var ret = new List <Block>(); long pos = 0; while (pos < size) { var length = Math.Min(size - pos, 1024 * 1024); var block = new Block(); block.OfTask = OfTask; block.Start = pos; block.Length = length; ret.Add(block); pos += length; } return(ret); }
public abstract List <Block> GetBlockList(FileTask OfTask);