private void frmPreview_Load(object sender, EventArgs e) { PicElement pe = new PicElement(this); pe.Article = new HitomiArticle(); pe.Article.Magic = id; Task.Run(() => HitomiCore.DownloadAndSetImageLink(pe, ImageLinkCallback)); }
private void PicDetailElement_Load(object sender, EventArgs e) { lTitle.Text = ha.Title; lArtist.Text = string.Join(",", ha.Artists ?? Enumerable.Empty <string>()); lSeries.Text = string.Join(",", ha.Series ?? Enumerable.Empty <string>()); lGroup.Text = string.Join(",", ha.Groups ?? Enumerable.Empty <string>()); lCharacter.Text = string.Join(",", ha.Characters ?? Enumerable.Empty <string>()); lDate.Text = HitomiDate.estimate_datetime(Convert.ToInt32(ha.Magic)).ToString(); if (ha.Tags != null) { ha.Tags.ToList().ForEach((a) => { a = HitomiCommon.LegalizeTag(a); if (a.StartsWith("female:")) { AddTagToPanel(a.Substring("female:".Length), 1); } else if (a.StartsWith("male:")) { AddTagToPanel(a.Substring("male:".Length), 2); } else { AddTagToPanel(a, 0); } }); } if (HitomiSetting.Instance.GetModel().UsingExHentaiBaseOpener) { metroButton4.Text = "익헨에서 열기"; } lLang.Text = ha.Language; if (HitomiSetting.Instance.GetModel().Language != "ALL") { label9.Dispose(); lLang.Dispose(); } for (int i = 0; i < Controls.Count; i++) { if (Controls[i] is Label && Controls[i] != lPage) { ConvertToVUILabel(Controls[i--] as Label); } } if (HitomiSetting.Instance.GetModel().ShowPageCount) { Task.Run(() => { string ppp = HitomiCore.GetPageCount(this).ToString() + "p"; this.Send(() => lPage.Text = ppp); }); } else { lPage.Dispose(); } }
private void AddMetadataToPanel(int i, string id) { string thumbnail = HitomiCore.GetThumbnailAddress(id); string temp = Path.GetTempFileName(); WebClient wc = new WebClient(); wc.Headers["Accept-Encoding"] = "application/x-gzip"; wc.Encoding = Encoding.UTF8; wc.DownloadFile(new Uri(HitomiDef.HitomiThumbnail + thumbnail), temp); Image img; using (FileStream fs = new FileStream(temp, FileMode.Open, FileAccess.Read, FileShare.None, 4096, FileOptions.DeleteOnClose)) { img = Image.FromStream(fs); } if (closed) { img.Dispose(); LogEssential.Instance.PushLog(() => $"Unexpected Disposed! {HitomiDef.HitomiThumbnail + thumbnail} {temp} {i} {id}"); return; } info[i] = new InfoWrapper(img.Clone() as Image); PictureBox[] pbs = { pb1, pb2, pb3, pb4 }; RemoveEvent(pbs[i], "EventMouseEnter"); RemoveEvent(pbs[i], "EventMouseMove"); RemoveEvent(pbs[i], "EventMouseLeave"); pbs[i].MouseEnter += info[i].Picture_MouseEnter; pbs[i].MouseMove += info[i].Picture_MouseMove; pbs[i].MouseLeave += info[i].Picture_MouseLeave; if (pbs[i].InvokeRequired) { pbs[i].Invoke(new Action(() => { pbs[i].Image = img; })); } else { pbs[i].Image = img; } LogEssential.Instance.PushLog(() => $"Load successful! {HitomiDef.HitomiThumbnail + thumbnail} {temp} {i} {id}"); }