Beispiel #1
0
 public override void RemoveCompleted()
 {
     //_service.RemoveCompleted();
     int[] keys = new int[_downloadFiles.Count];
     _downloadFiles.Keys.CopyTo(keys, 0);
     foreach (int key in keys)
     {
         DownloadFileTest downloadFileTest = _downloadFiles[key];
         if (downloadFileTest.DownloadEndTime <= DateTime.Now)
         {
             _downloadFiles.Remove(key);
         }
     }
 }
Beispiel #2
0
        public override int AddDownload(string url, string file = null, int segmentNb = 1, bool startNow = false)
        {
            //return _service.AddDownload(url, file, segmentNb, startNow);
            DownloadFileTest downloadFileTest = new DownloadFileTest();

            downloadFileTest.Id   = _id++;
            downloadFileTest.Url  = url;
            downloadFileTest.File = file;
            downloadFileTest.DownloadStartTime = DateTime.Now;
            downloadFileTest.DownloadDuration  = __defaultDownloadDuration;
            downloadFileTest.DownloadEndTime   = downloadFileTest.DownloadStartTime + downloadFileTest.DownloadDuration;
            _downloadFiles.Add(downloadFileTest.Id, downloadFileTest);
            return(downloadFileTest.Id);
        }
 public override int AddDownload(string url, string file = null, int segmentNb = 1, bool startNow = false)
 {
     //return _service.AddDownload(url, file, segmentNb, startNow);
     DownloadFileTest downloadFileTest = new DownloadFileTest();
     downloadFileTest.Id = _id++;
     downloadFileTest.Url = url;
     downloadFileTest.File = file;
     downloadFileTest.DownloadStartTime = DateTime.Now;
     downloadFileTest.DownloadDuration = __defaultDownloadDuration;
     downloadFileTest.DownloadEndTime = downloadFileTest.DownloadStartTime + downloadFileTest.DownloadDuration;
     _downloadFiles.Add(downloadFileTest.Id, downloadFileTest);
     return downloadFileTest.Id;
 }