/// <summary>
        /// 下载核心
        /// </summary>
        /// <param name="path"></param>
        /// <param name="dir"></param>
        /// <param name="filename"></param>
        /// <param name="id"></param>
        private void DownloadCore(string path, string dir, string filename)
        {
            try
            {
                using (FileDownloader loader = new FileDownloader(path, dir, filename, ThreadNum))
                {
                    DownMessageDto msg = new DownMessageDto();
                    msg.Tag       = DownStatus.Start;
                    msg.MD5String = FileId;
                    msg.Length    = (int)loader.getFileSize();
                    SendMsgAction(msg);

                    using (DownloadProgressListener linstenter = new DownloadProgressListener(msg))
                    {
                        linstenter.doSendMsg = new DownloadProgressListener.dlgSendMsg(SendMsgAction);
                        loader.DownloadAction(linstenter);//真正开始下载数据
                    }
                }
            }
            catch (Exception ex)
            {
                DownMessageDto msg = new DownMessageDto();
                msg.Length     = 0;
                msg.Tag        = DownStatus.Error;
                msg.ErrMessage = ex.Message;
                msg.MD5String  = FileId;
                SendMsgAction(msg);

                Console.WriteLine(ex.Message);
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="msg"></param>
 private void Change(DownMessageDto msg)
 {
     if (msg.Tag == DownStatus.Error || msg.Tag == DownStatus.End)
     {
         StartDown();
     }
     else if (msg.Tag == DownStatus.Start)
     {
         Console.WriteLine("开始下载");
     }
 }
            public void OnDownloadSize(long size)
            {
                if (downMsg == null)
                {
                    downMsg = new DownMessageDto();
                }
                //下载速度
                if (downMsg.Size == 0)
                {
                    downMsg.Speed = size;
                }
                else
                {
                    downMsg.Speed = (float)(size - downMsg.Size);
                }

                if (downMsg.Speed == 0)
                {
                    downMsg.Surplus     = -1;
                    downMsg.SurplusInfo = "未知";
                }
                else
                {
                    downMsg.Surplus = ((downMsg.Length - downMsg.Size) / downMsg.Speed);
                }
                downMsg.Size = size; //下载总量

                //下载中
                downMsg.Tag = DownStatus.DownLoad;
                if (size == downMsg.Length)
                {
                    //下载完成
                    downMsg.Tag         = DownStatus.End;
                    downMsg.Speed       = 0;
                    downMsg.SurplusInfo = "已完成";
                }
                doSendMsg?.Invoke(downMsg);//通知具体调用者下载进度
            }
 public DownloadProgressListener(DownMessageDto downmsg)
 {
     this.downMsg = downmsg;
     //this.id = id;
     //this.Length = Length;
 }