コード例 #1
0
 public bool DownUrl(string savePath, string workPath, out string errmsg)
 {
     if (uri != null)
     {
         _taskID = (DateTime.Now.Ticks + uri.AbsoluteUri).Md5_16();
         //int maxThreads = Environment.ProcessorCount / 2;
         int  threadCount = SystemSettings.DownloadTaskCount;
         bool _result;
         DownTotalCore.AddTask(_taskID);
         if (uri.AbsoluteUri.ToLower().EndsWith("m3u8"))
         {
             //M3u8下载
             _result = DownUrlByM3u8(threadCount, savePath, workPath, out errmsg);
         }
         else
         {
             _result = DownUrlByPlain(threadCount, savePath, workPath, out errmsg);
         }
         DownTotalCore.DelTask(_taskID);
         return(_result);
     }
     else
     {
         SetState(DownState.Fail);
         errmsg = "请初始化";
         return(false);
     }
 }
コード例 #2
0
 private void SetValue(double value)
 {
     if (_Value != value)
     {
         _Value = value;
         DownTotalCore.ChangeValueTask(_taskID, value);
         if (ValueChange != null)
         {
             ValueChange(this, value);
         }
     }
 }
コード例 #3
0
 private void SetMaxValue(double value)
 {
     if (_MaxValue != value)
     {
         _MaxValue = value;
         DownTotalCore.ChangeMaxValueTask(_taskID, value);
         if (MaxValueChange != null)
         {
             MaxValueChange(this, value);
         }
     }
 }