Example #1
0
        private void Client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message);
                Close();
                return;
            }

            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);
            rbrcit.ExtractFile(filename, job.path);

            File.Delete(filename);
            jobQueue.RemoveAt(jobQueue.Count - 1);
            downloadNextJob();
        }