Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public abstract List <Block> GetBlockList(FileTask OfTask);