Ejemplo n.º 1
0
 private void AddArticle(PicElement pe)
 {
     HitomiLog.Instance.AddArticle(pe.Article);
     HitomiLog.Instance.Save();
     downloaded_check.Add(pe);
     HitomiCore.DownloadAndSetImageLink(pe, ImageLinkCallback);
 }
Ejemplo n.º 2
0
        private void ProcessLoading(HitomiArticle article)
        {
            article.Thumbnail = HitomiCore.GetThumbnailAddress(article.Magic);

            string    temp = Path.GetTempFileName();
            WebClient wc   = new WebClient();

            wc.Headers["Accept-Encoding"] = "application/x-gzip";
            wc.Encoding = Encoding.UTF8;
            wc.DownloadFileCompleted += CallbackThumbnail;
            wc.DownloadFileAsync(new Uri(HitomiDef.HitomiThumbnail + article.Thumbnail), temp,
                                 new Tuple <string, HitomiArticle>(temp, article));
        }
Ejemplo n.º 3
0
        private void frmGalleryInfo_LoadAsync(object sender, EventArgs e)
        {
            lDate.Text = HitomiDate.estimate_datetime(Convert.ToInt32(id)).ToString();
            if (pic != null)
            {
                pbImage.Image   = pic.Image;
                lTitle.Text     = pic.Article.Title;
                lArtist.Text    = string.Join(",", pic.Article.Artists ?? Enumerable.Empty <string>());
                lSeries.Text    = string.Join(",", pic.Article.Series ?? Enumerable.Empty <string>());
                lGroup.Text     = string.Join(",", pic.Article.Groups ?? Enumerable.Empty <string>());
                lCharacter.Text = string.Join(",", pic.Article.Characters ?? Enumerable.Empty <string>());
                textBox1.Text   = string.Join(",", pic.Article.Tags ?? Enumerable.Empty <string>());

                if (pic.Article.Tags != null)
                {
                    pic.Article.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);
                        }
                    });
                }
            }
            else
            {
                lTitle.Text     = metadata.Name;
                lArtist.Text    = string.Join(",", metadata.Artists ?? Enumerable.Empty <string>());
                lSeries.Text    = string.Join(",", metadata.Parodies ?? Enumerable.Empty <string>());
                lGroup.Text     = string.Join(",", metadata.Groups ?? Enumerable.Empty <string>());
                lCharacter.Text = string.Join(",", metadata.Characters ?? Enumerable.Empty <string>());

                if (metadata.Tags != null)
                {
                    metadata.Tags.ToList().ForEach((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);
                        }
                    });
                }

                Task.Run(() => download_image());
            }

            if (HitomiSetting.Instance.GetModel().ShowPageCount)
            {
                Task.Run(() => {
                    string ppp = HitomiCore.GetPageCount(id).ToString() + "p";
                    this.Send(() => lPage.Text = ppp);
                });
            }
            else
            {
                lPage.Dispose();
            }
        }