예제 #1
0
        private async void btnStart_Click(object sender, EventArgs e)
        {
            pbMain.Value = 0;
            ToggleGroupBoxes(false);

            TitleBuilder.Build(this, "Initializing");

            try
            {
                var threadInfo = new ThreadInfo(txtThread.Text);

                var scraper = new Scraper(threadInfo, UpdateProgress);
                var files = await scraper.CollectFilePosts(cbWEBM.Checked, cbDuplicates.Checked);

                pbMain.Maximum = files.Count;

                await Task.WhenAll(files.Select(p =>
                    scraper.DownloadAsync(p, rbUID.Checked, txtPath.Text, this)));

                TitleBuilder.Build(this, "Completed", false);
            }
            catch (Exception ex)
            {
                TitleBuilder.Build(this, ex.Message, false);
            }

            ToggleGroupBoxes(true);
        }