private void frmArtistInfo_Load(object sender, EventArgs e) { Text += group; var hitomi_data = HitomiData.Instance.metadata_collection; Dictionary <string, int> tag_count = new Dictionary <string, int>(); int gallery_count = 0; foreach (var metadata in hitomi_data) { if (metadata.Groups != null && metadata.Tags != null && (metadata.Language == HitomiSetting.Instance.GetModel().Language || HitomiSetting.Instance.GetModel().Language == "ALL") && metadata.Groups.Contains(group)) { gallery_count += 1; foreach (var tag in metadata.Tags) { if (tag_count.ContainsKey(tag)) { tag_count[tag] += 1; } else { tag_count.Add(tag, 1); } } } } var result = tag_count.ToList(); result.Sort((pair1, pair2) => pair2.Value.CompareTo(pair1.Value)); List <ListViewItem> lvil = new List <ListViewItem>(); for (int i = 0; i < result.Count; i++) { lvil.Add(new ListViewItem(new string[] { result[i].Key, result[i].Value.ToString() })); } lvMyTagRank.Items.AddRange(lvil.ToArray()); pbLoad.Maximum = gallery_count; foreach (var metadata in hitomi_data) { if (metadata.Groups != null && (metadata.Language == HitomiSetting.Instance.GetModel().Language || HitomiSetting.Instance.GetModel().Language == "ALL") && metadata.Groups.Contains(group)) { HitomiArticle article = HitomiCommon.MetadataToArticle(metadata); Task.Run(() => ProcessLoading(article)); } } }
private void AddPanel() { int count = 0; foreach (var md in metadatas) { if (!md.Item3.HasValue) { continue; } count++; if (count == 100) { return; } string path = Path.Combine(tbPath.Text, md.Item1); IPicElement pe; pe = new PicElement(this); HitomiArticle article = HitomiCommon.MetadataToArticle(md.Item3.Value); pe.Article = article; pe.Label = article.Title; using (var zip = ZipFile.Open(path, ZipArchiveMode.Read)) { string tmp = Path.GetTempFileName(); zip.Entries[0].ExtractToFile(tmp, true); pe.SetImageFromAddress(tmp, 150, 200); } pe.Font = this.Font; this.Post(() => ImagePanel.Controls.Add(pe as Control)); } }