Пример #1
0
        public void This_DoubleClick(object sender, EventArgs e)
        {
            if (gallerie == null)
            {
                return;
            }

            if (Global.CheckDownloadID.IndexOf(gallerie.ID) == -1)
            {
                var Struct = new Library.AlamStruct("다운로드 시작", "ID : " + gallerie.ID + "\n제목 : " + gallerie.Title, 5f);
                Struct.ImagePath   = Global.Thumbnail + gallerie.ID + Global.ThumbnailExt;
                Struct.borderStyle = BorderStyle.FixedSingle;

                Global.manage.Add(Struct);

                Global.CheckDownloadID.Add(gallerie.ID);

                Thread th = new Thread(new ThreadStart(() =>
                {
                    OnDownload(gallerie, 0);
                    HioDownloader hio = new HioDownloader(gallerie);
                    hio.Downloads    += Hio_Downloads;
                    int startPage     = 0;

                    if (sender is int)
                    {
                        startPage = (int)sender != 0 ? (int)sender : 0;
                    }
                    hio.Download(Global.DownloadPath, startPage);
                    Global.CheckDownloadID.Remove(gallerie.ID);
                }));
                th.Start();
            }
            else
            {
                var Struct = new Library.AlamStruct("이미 다운로드 중입니다.", "ID : " + gallerie.ID + "\n제목 : " + gallerie.Title, 5f);
                Struct.ImagePath   = Global.Thumbnail + gallerie.ID + Global.ThumbnailExt;
                Struct.borderStyle = BorderStyle.FixedSingle;

                Global.manage.Add(Struct);
            }
        }
Пример #2
0
        private void Btn_DownloadStart_Click(object sender, EventArgs e)
        {
            Int_DownloadLog_List = 0;
            if (int.TryParse(Text_StartRange.Text, out int start) && int.TryParse(Text_EndRange.Text, out int end))
            {
                if (start < 1)
                {
                    start = 1;
                }
                if (end > int.Parse(Panel_Search_Download.Label_Select_Page.Text.Split(' ')[1]))
                {
                    end = int.Parse(Panel_Search_Download.Label_Select_Page.Text.Split(' ')[1]);
                }

                if (SearchResult.Count == 0)
                {
                    MessageBox.Show("검색을 하신뒤에 다운로드를 실행 시켜주세요.");
                    return;
                }


                try
                {
                    for (int i = (start - 1) * Previews.Count; i < end * Previews.Count; i++)
                    {
                        Thread th = new Thread(new ParameterizedThreadStart((data) => {
                            var g             = (Gallerie)data;
                            HioDownloader hio = new HioDownloader(g);
                            hio.Downloads    += Pre_Download;
                            hio.Download(Global.DownloadPath);
                            DownloadLog_AddReverse(g, 0);
                            DownloadLists.Add(g, 0);
                        }));
                        th.Start(SearchResult[i]);
                    }
                }catch (Exception e1)
                {
                    MessageBox.Show(e1.ToString());
                }
            }
        }
Пример #3
0
        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]);
            }
        }