Exemple #1
0
 public void DownloadCarModel(Car c)
 {
     if (c.link_model != null)
     {
         DownloadJob job = new DownloadJob();
         job.title = c.manufacturer + " " + c.name;
         job.URL   = c.link_model;
         job.path  = "Cars\\";
         FormDownload fd = new FormDownload(job, this);
         fd.FormClosed += FormDownloadClosedAllCars;
         fd.ShowAtCenterParent(mainForm);
     }
     else
     {
         Process.Start("http://www.ly-racing.de/viewtopic.php?t=7878");
     }
 }
Exemple #2
0
        public void DownloadPluginFixUp()
        {
            DownloadJob dj = new DownloadJob();

            dj.title = "FixUp Plugin";
            dj.path  = ".";
            dj.URL   = carlist_ini.GetParameterValue("plugin_fixup4_url", "Plugins");

            //legacy support for FixUp < v4
            if (dj.URL == null)
            {
                dj.URL  = carlist_ini.GetParameterValue("plugin_fixup_url", "Plugins");
                dj.path = "Plugins\\";
            }

            FormDownload fd = new FormDownload(dj, this);

            fd.FormClosed += FormDownloadClosedFixup;
            fd.ShowAtCenterParent(mainForm);
        }
        private void Client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
        {
            DownloadJob job = jobQueue[jobQueue.Count - 1];

            WebClient wc = (WebClient)e.UserState;
            string    header_contentDisposition = wc.ResponseHeaders["content-disposition"];

            filename = job.path + new ContentDisposition(header_contentDisposition).FileName;

            FileStream fs = new FileStream(filename, FileMode.Create);

            fs.Write(e.Result, 0, e.Result.Length);
            fs.Close();

            ZipManager.ExtractToDirectory(filename, job.path);

            File.Delete(filename);
            jobQueue.RemoveAt(jobQueue.Count - 1);
            downloadNextJob();
        }
Exemple #4
0
 void downloadNextJob()
 {
     if (jobQueue.Count > 0)
     {
         DownloadJob job = jobQueue[jobQueue.Count - 1];
         currentJob++;
         label1.Text = job.title + " (" + currentJob + " of " + totalJobs + " Files)";
         label3.Text = job.URL.Replace("%20", " ");
         using (var client = new WebClient())
         {
             client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
             client.DownloadDataCompleted   += Client_DownloadDataCompleted;
             Uri u = new Uri(job.URL);
             client.DownloadDataAsync(u, client);
         }
     }
     else
     {
         Close();
     }
 }
Exemple #5
0
 void downloadNextJob()
 {
     if (jobQueue.Count > 0)
     {
         DownloadJob job = jobQueue[jobQueue.Count - 1];
         //if (downloadPhysics) filename = "RBRCIT\\physics\\" + c.physics + ".zip";
         //else filename = "Cars\\" + c.folder + ".7z";
         currentJob++;
         label1.Text = job.title + " (" + currentJob + " of " + totalJobs + " Files)";
         using (var client = new WebClient())
         {
             client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
             client.DownloadDataCompleted   += Client_DownloadDataCompleted;
             Uri u = new Uri(job.URL);
             client.DownloadDataAsync(u, client);
         }
     }
     else
     {
         Close();
     }
 }
Exemple #6
0
 public FormDownload(DownloadJob job, RBRCITModel model) : this(new List <DownloadJob>() { job }, model)
 {
 }
 public FormDownload(DownloadJob job) : this(new List <DownloadJob>() { job })
 {
 }