Beispiel #1
0
 private void btnDl_Click(object sender, EventArgs e)
 {
     if (!downing)
     {
         downy = new HttpWebDownloader(urlIn.Text, destIn.Text);
         //downy.ProgressChanged += Downy_ProgressChanged;
         downy.Start();
         downing = true;
         btnDl.Text = "Stop";
         timer.Enabled = true;
         if (downy.Size > int.MaxValue)
         {
             progress.Maximum = int.MaxValue;
             progRatio = (decimal)int.MaxValue / downy.Size;
         }
         else
         {
             progress.Maximum = (int)downy.Size;
             progRatio = 1m;
         }
     }
     else
     {
         downy.Stop();
         downing = false;
         btnDl.Text = "Start";
         timer.Enabled = false;
     }
 }
        public HttpWebDlHelper(HttpWebDownloader parent, long begin, long end)
        {
            this.parent = parent;
            this.begin = begin;
            this.end = end;

            Status = DownloadStatus.Stopped;

            workingFile = Path.Combine(parent.TemporaryDir,
                "." + begin + "~" + end + ".abdownpart");

            if (File.Exists(workingFile))
            {
                Completed = new FileInfo(workingFile).Length;
            }
            else
            {
                File.Create(workingFile).Dispose();
                Completed = 0;
            }
        }