private void Text_Search_Changed(object sender, EventArgs e) { var v = sender as Control; var listbox = SearchPairs["listBox_" + v.Name.Split('_')[1]]; listbox.Items.Clear(); switch (v.Name.Split('_')[1][0]) { case 'T': listbox.Items.AddRange(SearchListBox.GetListBox(Global.Tags, v.Text)); break; case 'S': listbox.Items.AddRange(SearchListBox.GetListBox(Global.Series, v.Text)); break; case 'C': listbox.Items.AddRange(SearchListBox.GetListBox(Global.Character, v.Text)); break; } }
private void DownloadPage_Load(object sender, EventArgs e) { #region Read DB for (int i = 0; i < 20; i++) { FileInfo fi = new FileInfo(Global.DBPath + Global.DBName + i.ToString() + Global.DBExt); if (!fi.Exists) { DBDownloader.DBDownload(); break; } } Thread tagsDB = new Thread(new ThreadStart(() => { FileInfo fi = new FileInfo(Global.DBPath + Global.DBTags + Global.DBExt); if (!fi.Exists) { DBDownloader.InfoDownload("tags"); } StreamReader sr = new StreamReader(Global.DBPath + Global.DBTags + Global.DBExt); while (!sr.EndOfStream) { Global.Tags.Add(sr.ReadLine()); } sr.Close(); if (!Global.SpeedLimit) { listBox_TagAdd.Items.AddRange(SearchListBox.GetListBox(Global.Tags, String.Empty)); listBox_TagDelete.Items.AddRange(SearchListBox.GetListBox(Global.Tags, String.Empty)); } })); Thread seriesDB = new Thread(new ThreadStart(() => { FileInfo fi = new FileInfo(Global.DBPath + Global.DBSeries + Global.DBExt); if (!fi.Exists) { DBDownloader.InfoDownload("series"); } StreamReader sr = new StreamReader(Global.DBPath + Global.DBSeries + Global.DBExt); while (!sr.EndOfStream) { Global.Series.Add(sr.ReadLine()); } sr.Close(); if (!Global.SpeedLimit) { listBox_SeriesAdd.Items.AddRange(SearchListBox.GetListBox(Global.Series, String.Empty)); } })); Thread characterDB = new Thread(new ThreadStart(() => { FileInfo fi = new FileInfo(Global.DBPath + Global.DBCharcter + Global.DBExt); if (!fi.Exists) { DBDownloader.InfoDownload("characters"); } StreamReader sr = new StreamReader(Global.DBPath + Global.DBCharcter + Global.DBExt); while (!sr.EndOfStream) { Global.Character.Add(sr.ReadLine()); } sr.Close(); if (!Global.SpeedLimit) { listBox_CharacterAdd.Items.AddRange(SearchListBox.GetListBox(Global.Character, String.Empty)); listBox_CharacterDelete.Items.AddRange(SearchListBox.GetListBox(Global.Character, String.Empty)); } })); Thread artistsDB = new Thread(new ThreadStart(() => { FileInfo fi = new FileInfo(Global.DBPath + Global.DBArtist + Global.DBExt); if (!fi.Exists) { DBDownloader.InfoDownload("artists"); } StreamReader sr = new StreamReader(Global.DBPath + Global.DBArtist + Global.DBExt); while (!sr.EndOfStream) { Global.Artist.Add(sr.ReadLine()); } sr.Close(); if (!Global.SpeedLimit) { listBox_ArtistAdd.Items.AddRange(SearchListBox.GetListBox(Global.Artist, String.Empty)); } })); tagsDB.Start(); seriesDB.Start(); characterDB.Start(); artistsDB.Start(); #endregion FileInfo fis = new FileInfo(Global.ReDownloadPath); if (!fis.Exists) { return; } BinaryFormatter binFmt = new BinaryFormatter();; using (FileStream rdr = new FileStream(Global.ReDownloadPath, FileMode.Open)) { Global.HioDownGalleries = (DownloadGallerie)binFmt.Deserialize(rdr); } for (int i = 0; i < Global.HioDownGalleries.ID.Count; i++) { Thread th = new Thread(new ParameterizedThreadStart((data) => { var g = Global.HioDownGalleries.Galleries[(int)data]; HioDownloader hio = new HioDownloader(g); hio.Downloads += Pre_Download; if (Global.HioDownGalleries.DownloadPage[(int)data] - 1 == -1) { hio.Download(Global.DownloadPath, 0); } else { hio.Download(Global.DownloadPath, Global.HioDownGalleries.DownloadPage[(int)data] - 1); } })); th.Start(i); var gs = Global.HioDownGalleries.Galleries[i]; DownloadLog_AddReverse(gs, Global.HioDownGalleries.DownloadPage[i] / Global.HioDownGalleries.TotalPage[i]); DownloadLists.Add(gs, Global.HioDownGalleries.DownloadPage[i] / Global.HioDownGalleries.TotalPage[i]); } }