예제 #1
0
        private void downloadBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (pathTxt.Text.Equals("") || pathTxt.Text == null)
                    throw new Exception("Path is not Valid!");

                if(!Path.IsPathRooted(pathTxt.Text))
                    throw new Exception("Path is not Valid!");

                string [] lst = PageParser.ParsePagesList(urlTxt.Text);
                Doujin doujin = new Doujin(PageParser.ParseDoujinName(urlTxt.Text));
                string directory = Path.Combine(pathTxt.Text,doujin.Name);
                doujin.DownloadPath = directory;

                int i = 0;
                foreach (var url in lst)
                {
                    string pageName = PageParser.ParsePageIndexName(i, lst.Length, url);
                    DoujinPage page = new DoujinPage(pageName, url);
                    doujin.AddPage(page);
                    i++;
                }
                Directory.CreateDirectory(directory);
                DownloadForm downloader = new DownloadForm(doujin);
                downloader.ShowDialog();

            }
            catch(Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK);
            }
        }
예제 #2
0
 public void AddPage(DoujinPage page)
 {
     this.PageList.Add(page);
 }