Example #1
0
        private void AddDownloadFile(string name, string url)
        {
            string dir = System.AppDomain.CurrentDomain.BaseDirectory;

            strDownFilePath = dir + name;
            downLoadFile.AddDown(url, dir, 0, name);
            Console.WriteLine("准备下载文件:" + name);
        }
Example #2
0
 internal void Download(string path, string url)
 {
     if (!s)
     {
         dlf.doSendMsg += new DownLoadFile.dlgSendMsg(SendMsgHander);
         s              = true;
     }
     dlf.AddDown(url, path.Replace(Path.GetFileName(path), ""), Path.GetFileName(path), id);
     dlf.StartDown(10);
 }
Example #3
0
        /// <summary>
        /// 下载
        /// </summary>
        /// <param name="path">下载路径</param>
        /// <param name="url">下载网址</param>
        /// <param name="name">名称</param>
        public void download(string path, string url, string name)//建议采用该写法进行下载
        {
            string[] a  = path.Split(Convert.ToChar(@"\"));
            string   ap = null;

            for (int i = 0; i < a.Length - 1; i++)
            {
                if (i == a.Length - 2)
                {
                    ap += a[i];
                    break;
                }
                ap += a[i] + @"\";
            }
            Console.WriteLine(ap);
            int          id   = listView2.Items.Count;
            ListViewItem item = listView2.Items.Add(new ListViewItem(new string[] { (listView2.Items.Count + 1).ToString(), name, "0%", "等待中", "0B/S" }));

            dlf.AddDown(url, ap, a[a.Length - 1], id); //增加下载
            dlf.StartDown();                           //开始下载
        }