Ejemplo n.º 1
0
        private async void DownloadData_Click(object sender, RoutedEventArgs e)
        {
            bool hiyobi = ftype == Hitomi.Type.Hiyobi;

            if (ftype == Hitomi.Type.Folder)
            {
                bool result = await new InternetP(index: int.Parse(h.id)).isHiyobi();
                hiyobi = result;
            }
            if (hiyobi)
            {
                Hitomi h2 = await new HiyobiLoader(text: h.id).Parser();
                if (h2.name == "정보없음" && h2.id == "0")
                {
                    MessageBox.Show("데이터를 받아오는데 실패했습니다.");
                    return;
                }
                string folder = h.dir;
                if (h.type != Hitomi.Type.Folder)
                {
                    folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Global.DownloadFolder, File2.GetDownloadTitle(File2.SaftyFileName(h2.name)));
                }
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
                File.WriteAllText(Path.Combine(folder, "info.json"), JObject.FromObject(h2).ToString());
                MessageBox.Show("데이터를 성공적으로 받았습니다.");
                authorsPanel.Children.Clear();
                authorsPanel.Children.Add(new Label {
                    Content = "작가 :"
                });
                tagPanel.Children.Clear();
                Init();
            }
            if (!hiyobi)
            {
                InternetP parser = new InternetP();
                parser.index = int.Parse(h.id);
                Hitomi h2 = await parser.HitomiData2();

                string folder = h.dir;
                if (h.type != Hitomi.Type.Folder)
                {
                    folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Global.DownloadFolder, File2.GetDownloadTitle(File2.SaftyFileName(h2.name)));
                }
                if (!Directory.Exists(folder))
                {
                    Directory.CreateDirectory(folder);
                }
                File.WriteAllText(Path.Combine(folder, "info.json"), JObject.FromObject(h2).ToString());
                MessageBox.Show("데이터를 성공적으로 받았습니다.");
                authorsPanel.Children.Clear();
                authorsPanel.Children.Add(new Label {
                    Content = "작가 :"
                });
                tagPanel.Children.Clear();
                Init();
            }
        }
Ejemplo n.º 2
0
        public async Task Parser(int[] ids)
        {
            start(ids.Length);
            InternetP parser = new InternetP();

            for (int i = 0; i < ids.Length; i++)
            {
                parser.index = ids[i];
                Hitomi h = await parser.HitomiData2();

                update(h, i, ids.Count());
            }
            end();
        }
Ejemplo n.º 3
0
        public async void Parser()
        {
            InternetP parser = new InternetP();

            parser.index = (index - 1) * count;
            parser.count = count;
            parser.url   = "https://ltn.hitomi.la/index-all.nozomi";
            int[] ids = parser.ByteArrayToIntArray(await parser.LoadNozomi());
            start(ids.Count());
            foreach (int id in ids)
            {
                parser.index = id;
                Hitomi h = await parser.HitomiData2();

                update(h, ids.ToList().IndexOf(id), ids.Count());
            }
            end();
        }