public static IList <BaseEntry> GenerateSiteEntries(IList <BaseEntry> entries) { var result = new List <BaseEntry>(); var need = new Dictionary <string, int>(); var have = new Dictionary <string, int>(); foreach (var baseentry in entries) { result.Add(baseentry); if (baseentry is SiteEntry site) { have[site.site] = 1; } if (baseentry is PassEntry pass) { need[pass.site] = 1; } } foreach (var item in have) { need.Remove(item.Key); } foreach (var item in need) { var entry = new SiteEntry { site = item.Key }; result.Insert(0, entry); } return(result); }
private void downloadsb_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in list.SelectedRows) { try { //SiteEntry entry = (SiteEntry)list.SelectedRows[0].DataBoundItem; SiteEntry entry = (SiteEntry)row.DataBoundItem; statusl.Text = "Downloading..."; //entry.DownloadImage(Properties.Settings.Default["folder"].ToString()+"\\"+entry.Id + ".jpg"); // Check if there's an output folder. if (Properties.Settings.Default["folder"].ToString() == "") { MessageBox.Show("It seems like this is your first time running WolfBox. Please select a folder to output all of your images.", "Select an output folder", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); DialogResult result = fb.ShowDialog(); if (result == DialogResult.OK) { statusl.Text = "Output folder set to " + fb.SelectedPath; Properties.Settings.Default["folder"] = fb.SelectedPath; } } var data = new { author = entry.Author, id = entry.Id, tags = entry.Tags, }; entry.DownloadImage(Properties.Settings.Default["folder"] + "\\" + Properties.Settings.Default["fname"].ToString().FormatWith(data) + ".jpg"); Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); //w.DownloadFile(entry.ImageURL, Properties.Settings.Default["folder"].ToString()); } catch (Exception ex) { MessageBox.Show("ERROR: " + ex.Message.ToString() + "\n Please check your options"); } } }