Ejemplo n.º 1
0
        private void Se_Find(object sender, Gallerie e)
        {
            SearchResult.Add(e);


            try
            {
                Preview_AddReverse(e);

                Panel_Search_Download.Label_Select_Page?.Invoke(new MethodInvoker(() =>
                {
                    if (Math.Ceiling((double)SearchResult.Count / Previews.Count) != int.Parse(Panel_Search_Download.Label_Select_Page.Text.Split(' ')[1]))
                    {
                        Panel_Search_Download.Label_Select_Page.Text = "~ " + Math.Ceiling((double)SearchResult.Count / Previews.Count).ToString();
                    }
                }));
                ///
                /// MessageBox.show Preview.Count가 0이라서 생기는 오류
                ///
                ///
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 2
0
        private void Preview_AddReverse(Gallerie gallerie)
        {
            if (Int_Preview_List < Previews.Count)
            {
                Previews[Int_Preview_List].Clear();
                try
                {
                    Previews[Int_Preview_List].Invoke(new MethodInvoker(() =>
                    {
                        Previews[Int_Preview_List].Clear();
                        Previews[Int_Preview_List].Label_ID.Text += gallerie.ID;

                        Previews[Int_Preview_List].Label_Title.Text    += gallerie.Title;
                        Previews[Int_Preview_List].Label_Group.Text    += gallerie.Uploader;
                        Previews[Int_Preview_List].Label_Series.Text   += gallerie.Series;
                        Previews[Int_Preview_List].Label_Type.Text     += gallerie.Type;
                        Previews[Int_Preview_List].Label_Language.Text += gallerie.Language;

                        for (int i = 0; i < gallerie.Tags.Count - 1; i++)
                        {
                            Previews[Int_Preview_List].Label_Tags.Text += gallerie.Tags[i] + ", ";
                        }
                        if (gallerie.Tags.Count != 0)
                        {
                            Previews[Int_Preview_List].Label_Tags.Text += gallerie.Tags[gallerie.Tags.Count - 1];
                        }

                        for (int i = 0; i < gallerie.Character.Count - 1; i++)
                        {
                            Previews[Int_Preview_List].Label_Character.Text += gallerie.Character[i] + ", ";
                        }
                        if (gallerie.Character.Count != 0)
                        {
                            Previews[Int_Preview_List].Label_Character.Text += gallerie.Character[gallerie.Character.Count - 1];
                        }

                        Previews[Int_Preview_List].DetailHover += Preview_DetailHover;
                        Previews[Int_Preview_List].DetailLeave += Preview_DetailLeave;

                        Previews[Int_Preview_List].GetThumbnail(gallerie);
                    }));
                }
                catch (Exception)
                {
                    // MessageBox.Show(e123.ToString() + " " + gallerie.ID + " " + gallerie.Title);
                }



                for (int i = 0; i < Previews.Count; i++)
                {
                    Previews[i].Invoke(new MethodInvoker(() => { Previews[i].Refresh(); }));
                }
                Int_Preview_List++;
            }
        }
Ejemplo n.º 3
0
        public void GetThumbnail(Gallerie g)
        {
            gallerie = g;

            DirectoryInfo di = new DirectoryInfo(Global.Thumbnail);

            if (!di.Exists)
            {
                di.Create();
            }
            FileInfo fi = new FileInfo(Global.Thumbnail + g.ID + Global.ThumbnailExt);

            if (fi.Exists)
            {
                Pic_Image.Image = Image.FromFile(fi.FullName);
                return;
            }

            if (Global.DownloadedID.IndexOf(g.ID) == -1)
            {
                Global.DownloadedID.Add(g.ID);
                th = new Thread(new ParameterizedThreadStart((Gall) =>
                {
                    using (WebClient wc = new WebClient())
                    {
                        Gallerie date = Gall as Gallerie;
                        string ID     = date.ID;
                        string Images = date.ThumnailImage;
                        string str    = wc.DownloadString(Images);
                        string name   = Regex.Split(str, "//tn.hitomi.la/bigtn/")[1].Split('\"')[0];

                        try
                        {
                            wc.DownloadFile("https://tn.hitomi.la/bigtn/" + name, Global.Thumbnail + ID + Global.ThumbnailExt);
                            if (g != null && date.ID == g.ID)
                            {
                                Pic_Image?.Invoke(new MethodInvoker(() =>
                                {
                                    Pic_Image.Image = Image.FromFile(fi.FullName);
                                }));
                            }
                        }
                        catch (Exception e1)
                        {
                            if (e1.HResult != -2147467261)
                            {
                                MessageBox.Show(e1.ToString());
                            }
                        }
                    }
                    Global.DownloadedID.Remove(g.ID);
                }));
            }

            th.Start(g);
        }
Ejemplo n.º 4
0
        public void Remove(Gallerie g)
        {
            int num = galleries.IndexOf(g);

            if (num != -1)
            {
                galleries.RemoveAt(num);
                percentage.RemoveAt(num);
            }
        }
Ejemplo n.º 5
0
        public void Clear()
        {
            gallerie          = null;
            Label_Title.Text  = "Title : ";
            Label_Lang.Text   = "Language : ";
            Label_Type.Text   = "Type : ";
            Label_Series.Text = "Series : ";

            Pic_Image.Image = null;
        }
Ejemplo n.º 6
0
        public void Add(Gallerie g, float Percentage)
        {
            int num = galleries.IndexOf(g);

            if (num == -1)
            {
                galleries.Add(g);
                percentage.Add(Percentage);
            }
            else
            {
                percentage[num] = Percentage;
            }
        }
Ejemplo n.º 7
0
        //
        // 0 : downloadPage
        // 1 : viewPage
        // 2 : optionPage
        //
        //
        private void Page_Change(int page)
        {
            if (page == 0)
            {
                downloadPage.Visible = true;
                viewerPage.Visible   = false;
                optionPage.Visible   = false;
            }
            else if (page == 1)
            {
                viewerPage.infos.Clear();
                FileInfo fi = new FileInfo(Global.DownloadPath + Global.DownloadDBName + Global.DBExt);
                if (fi.Exists)
                {
                    HashSet <Gallerie> list = new HashSet <Gallerie>();

                    using (StreamReader sr = new StreamReader(Global.DownloadPath + Global.DownloadDBName + Global.DBExt))
                    {
                        while (!sr.EndOfStream)
                        {
                            var      data = sr.ReadLine().Split((char)255);
                            Gallerie g    = new Gallerie
                            {
                                ID       = data[0],
                                Type     = data[1],
                                Language = data[2],
                                Series   = data[3],
                                Title    = data[4]
                            };

                            list.Add(g);
                        }
                        viewerPage.infos.AddRange(list);
                        sr.Close();
                    }
                    viewerPage.Explorer_Set(new KeyEventArgs(Keys.Enter), true);
                }
                downloadPage.Visible = false;
                viewerPage.Visible   = true;
                optionPage.Visible   = false;
            }
            else
            {
                downloadPage.Visible = false;
                viewerPage.Visible   = false;
                optionPage.Visible   = true;
            }
        }
Ejemplo n.º 8
0
        private void ViewerPage_ViewEvent(object sender, Gallerie e)
        {
            ViewGallerie = e;
            StreamReader sr   = new StreamReader(Global.DownloadPath + e.ID + "\\info.ini");
            string       page = Regex.Split(sr.ReadToEnd(), "Page : ")[1].Split('\n')[0];

            Label_Page.Text = "~ " + page.ToString();
            Text_Page.Text  = "1";
            try
            {
                Pic_Viewer.Image = Image.FromFile(Global.DownloadPath + e.ID + "\\" + Text_Page.Text + ".jpg");
            }
            catch (Exception)
            {
            }
        }
Ejemplo n.º 9
0
        private void InfoFileWrite(Gallerie g, int page, string Download_Path)
        {
            StreamWriter sw = new StreamWriter(Download_Path + "\\" + g.ID + "\\Info.ini", false, Encoding.UTF8);

            sw.WriteLine("URL : https://hitomi.la/galleries/" + g.ID);
            sw.WriteLine("ID : " + g.ID);
            sw.WriteLine("Title : " + g.Title);
            sw.WriteLine("Group : " + g.Uploader);
            sw.WriteLine("Series : " + g.Series);
            sw.WriteLine("Type : " + g.Type);
            sw.WriteLine("Language : " + g.Language);
            sw.WriteLine("Page : " + page);

            sw.Write("Tags : ");
            for (int i = 0; i < g.Tags.Count; i++)
            {
                if (i == g.Tags.Count - 1)
                {
                    sw.Write(g.Tags[i]);
                }
                else
                {
                    sw.Write(g.Tags[i] + ", ");
                }
            }
            sw.WriteLine();


            sw.Write("Character : ");
            for (int i = 0; i < g.Character.Count; i++)
            {
                if (i == g.Character.Count - 1)
                {
                    sw.Write(g.Character[i]);
                }
                else
                {
                    sw.Write(g.Character[i] + ", ");
                }
            }
            sw.WriteLine();

            sw.Close();
        }
Ejemplo n.º 10
0
        private void DownloadLog_AddReverse(Gallerie gallerie, float percentage)
        {
            foreach (var data in DownloadLogs)
            {
                if (data.gallerie != null && data.gallerie.ID == gallerie.ID)
                {
                    data.Percentage = percentage;
                    return;
                }
            }

            if (Int_DownloadLog_List < DownloadLogs.Count)
            {
                try
                {
                    DownloadLogs[Int_DownloadLog_List].Invoke(new MethodInvoker(() =>
                    {
                        DownloadLogs[Int_DownloadLog_List].Clear();

                        DownloadLogs[Int_DownloadLog_List].Percentage           = percentage;
                        DownloadLogs[Int_DownloadLog_List].Label_ID.Text       += gallerie.ID;
                        DownloadLogs[Int_DownloadLog_List].Label_Title.Text    += gallerie.Title;
                        DownloadLogs[Int_DownloadLog_List].Label_Series.Text   += gallerie.Series;
                        DownloadLogs[Int_DownloadLog_List].Label_Type.Text     += gallerie.Type;
                        DownloadLogs[Int_DownloadLog_List].Label_Language.Text += gallerie.Language;

                        DownloadLogs[Int_DownloadLog_List].GetThumbnail(gallerie);
                    }));
                    DownloadLogs[Int_DownloadLog_List].DetailHover += Preview_DetailHover;
                    DownloadLogs[Int_DownloadLog_List].DetailLeave += Preview_DetailLeave;
                }
                catch (Exception)
                {
                    // MessageBox.Show(e123.ToString() + " " + gallerie.ID + " " + gallerie.Title);
                }

                for (int i = 0; i < Previews.Count; i++)
                {
                    DownloadLogs[i].Invoke(new MethodInvoker(() => { DownloadLogs[i].Refresh(); }));
                }
                Int_DownloadLog_List++;
            }
        }
Ejemplo n.º 11
0
        public void Add(Gallerie mID, int mDownloadPage, int mTotalPage)
        {
            int num = ID.IndexOf(mID.ID);

            if (num == -1)
            {
                if (mDownloadPage == 0)
                {
                    Galleries.Add(mID);
                    ID.Add(mID.ID);
                    DownloadPage.Add(mDownloadPage);
                    TotalPage.Add(mTotalPage);
                }
            }
            else
            {
                DownloadPage[num] = mDownloadPage;
                TotalPage[num]    = mTotalPage;
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        ///
        ///
        ///
        ///              수정해야하는거 : 퍼센트 100%되면은
        ///              삭제하고 갱신하기.
        ///
        ///              다 만들고 뷰어 만들기.
        ///
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="Percentage"></param>
        private void Pre_Download(object sender, Gallerie e, float Percentage)
        {
            if (Percentage <= -1.0f)
            {
                Panel_Download_List?.Invoke(new MethodInvoker(() =>
                {
                    var Struct         = new Library.AlamStruct("다운로드 중지", "ID : " + e.ID + "\n제목 : " + e.Title, 5f);
                    Struct.ImagePath   = Global.Thumbnail + e.ID + Global.ThumbnailExt;
                    Struct.borderStyle = BorderStyle.FixedSingle;


                    Global.manage.Add(Struct);
                    DownloadLists.Remove(e);
                    LText_Select_Page_KeyDown(null, new KeyEventArgs(Keys.Enter));
                }));
            }
            else if (Percentage >= 1.0f)
            {
                if (!Global.ProgramExit)
                {
                    Panel_Download_List?.Invoke(new MethodInvoker(() =>
                    {
                        DownloadLog_AddReverse(e, Percentage);
                        DownloadLists.Remove(e);
                        LText_Select_Page_KeyDown(null, new KeyEventArgs(Keys.Enter));
                        StreamWriter sw = new StreamWriter(Global.DownloadPath + Global.DownloadDBName + Global.DBExt, true, Encoding.UTF8);
                        sw.WriteLine(e.ID + (char)255 + e.Type + (char)255 + e.Language + (char)255 + e.Series + (char)255 + e.Title);
                        sw.Close();


                        var Struct         = new Library.AlamStruct("다운로드 완료", "ID : " + e.ID + "\n제목 : " + e.Title, 5f);
                        Struct.ImagePath   = Global.Thumbnail + e.ID + Global.ThumbnailExt;
                        Struct.borderStyle = BorderStyle.FixedSingle;

                        Global.manage.Add(Struct);
                    }));
                }
                else
                {
                    DownloadLists.Remove(e);
                    StreamWriter sw = new StreamWriter(Global.DownloadPath + Global.DownloadDBName + Global.DBExt, true, Encoding.UTF8);
                    sw.WriteLine(e.ID + (char)255 + e.Type + (char)255 + e.Language + (char)255 + e.Series + (char)255 + e.Title);
                    sw.Close();
                }
            }
            else
            {
                if (Global.ProgramExit != true)
                {
                    DownloadLists.Add(e, Percentage);
                    DownloadLog_AddReverse(e, Percentage);
                }
            }

            try
            {
                if (DownloadLogs.Count != 0)
                {
                    Panel_Download_List.Label_Select_Page?.Invoke(new MethodInvoker(() =>
                    {
                        if (Math.Ceiling((double)(DownloadLists.galleries.Count) / DownloadLogs.Count) != int.Parse(Panel_Download_List.Label_Select_Page.Text.Split(' ')[1]))
                        {
                            Panel_Download_List.Label_Select_Page.Text = "~ " + Math.Ceiling((double)DownloadLists.galleries.Count / DownloadLogs.Count).ToString();
                        }
                    }));
                }
            }catch (Exception)
            {
                ///
                ///
                ///
                ///
            }
        }
Ejemplo n.º 13
0
 public HioDownloader(Gallerie gallerie)
 {
     g = gallerie;
 }
Ejemplo n.º 14
0
        public void Find_Start(SearchData search, Panel Bar, Control text, bool IsOld = false)
        {
            for (int i = 0; i < 20; i++)
            {
                FileInfo fi = new FileInfo(Global.DBPath + Global.DBName + i.ToString() + Global.DBExt);
                if (!fi.Exists)
                {
                    DBDownloader.DBDownload();
                    var Struct = new Library.AlamStruct("Error", "DB파일이 존재하지 않아서 다운로드합니다.", 5f);
                    Global.manage.Add(Struct);
                    return;
                }
            }

            if (!IsOld)
            {
                var result = new List <JToken>();

                // DB가 0부터 19까지 존재합니다.
                for (int i = 0; i < 20; i++)
                {
                    int we = 0;
                    try
                    {
                        ///
                        /// 검색기능
                        ///
                        using (StreamReader sr = new StreamReader(Global.DBPath + Global.DBName + i.ToString() + Global.DBExt))
                        {
                            JArray list = JArray.Parse(sr.ReadToEnd());
                            we = 1;
                            // 검색한 자료만큼 반복을 합니다.
                            for (int w = 0; w < list.Count; w++)
                            {
                                if (Stop)
                                {
                                    return;
                                }
                                we = 2;
                                JObject j        = list[w].ToObject <JObject>();
                                bool    IsSearch = true;

                                // 필요없는 데이터 처리.

                                foreach (var content in j)
                                {
                                    if (search.Character_Delete.Count != 0 && content.Key == "c")
                                    {
                                        foreach (var delete in search.Character_Delete)
                                        {
                                            foreach (var contentName in content.Value)
                                            {
                                                if (delete == contentName.ToString().ToLower())
                                                {
                                                    IsSearch = false;
                                                    break;
                                                }
                                            }
                                            if (!IsSearch)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                    else if (search.Series_Delete.Count != 0 && content.Key == "p")
                                    {
                                        foreach (var delete in search.Series_Delete)
                                        {
                                            foreach (var contentName in content.Value)
                                            {
                                                if (delete == contentName.ToString().ToLower())
                                                {
                                                    IsSearch = false; break;
                                                }
                                            }
                                            if (!IsSearch)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                    else if (search.Tags_Delete.Count != 0 && content.Key == "t")
                                    {
                                        foreach (var data in search.Tags_Delete)
                                        {
                                            foreach (var contentName in content.Value)
                                            {
                                                if (data == contentName.ToString().ToLower())
                                                {
                                                    IsSearch = false;
                                                }
                                            }
                                            if (!IsSearch)
                                            {
                                                break;
                                            }
                                        }
                                    }

                                    if (IsSearch == false)
                                    {
                                        break;
                                    }
                                }

                                if (IsSearch)
                                {
                                    IsSearch = IsSearchData(search, j);
                                }

                                // 이 자료가 찾은 검색에 적합한지에 조사합니다.
                                if (IsSearch)
                                {
                                    // 찾은 검색에 적합한지에 조사한 자료에 본격적인 조사를 합니다.
                                    foreach (var content in j)
                                    {
                                        if (search.Title.Length != 0 && content.Key == "n")
                                        {
                                            if (content.Value.ToString().ToLower().IndexOf(search.Title, 0) == -1)
                                            {
                                                IsSearch = false;
                                            }
                                        }
                                        else if (search.Language.Count != 0 && content.Key == "l")
                                        {
                                            bool chk = false;
                                            foreach (var lang in search.Language)
                                            {
                                                if (lang == content.Value.ToString())
                                                {
                                                    chk = true;
                                                    break;
                                                }
                                            }
                                            IsSearch = chk;
                                        }
                                        else if (search.Type.Count != 0 && content.Key == "type")
                                        {
                                            bool chk = false;
                                            foreach (var Type in search.Type)
                                            {
                                                if (Type == content.Value.ToString())
                                                {
                                                    chk = true;
                                                    break;
                                                }
                                            }
                                            IsSearch = chk;
                                        }
                                        else if (search.Character.Count != 0 && content.Key == "c")
                                        {
                                            int count = 0;

                                            foreach (var data in search.Character)
                                            {
                                                foreach (var contentName in content.Value)
                                                {
                                                    if (contentName.ToString().ToLower() == data)
                                                    {
                                                        count++;
                                                    }
                                                }
                                            }
                                            if (count != search.Character.Count)
                                            {
                                                IsSearch = false;
                                            }
                                        }
                                        else if (search.Series.Count != 0 && content.Key == "p")
                                        {
                                            int count = 0;

                                            foreach (var data in search.Series)
                                            {
                                                foreach (var contentName in content.Value)
                                                {
                                                    if (contentName.ToString().ToLower() == data)
                                                    {
                                                        count++;
                                                    }
                                                }
                                            }
                                            if (count == 0)
                                            {
                                                IsSearch = false;
                                            }
                                        }
                                        else if (search.Tags.Count != 0 && content.Key == "t")
                                        {
                                            int count = 0;

                                            foreach (var data in search.Tags)
                                            {
                                                foreach (var contentName in content.Value)
                                                {
                                                    if (contentName.ToString().ToLower() == data)
                                                    {
                                                        count++;
                                                    }
                                                }
                                            }
                                            if (count != search.Tags.Count)
                                            {
                                                IsSearch = false;
                                            }
                                        }
                                        else if (search.Artist.Count != 0 && content.Key == "a")
                                        {
                                            bool chk = false;
                                            foreach (var lang in search.Artist)
                                            {
                                                if (lang == content.Value.ToString())
                                                {
                                                    chk = true;
                                                    break;
                                                }
                                            }
                                            IsSearch = chk;
                                        }

                                        if (IsSearch == false)
                                        {
                                            break;
                                        }
                                    }
                                }

                                // 검색한 결과를 OnFind 이벤트를 통해서 전달합니다.
                                if (IsSearch)
                                {
                                    we = 6;
                                    Gallerie g = new Gallerie
                                    {
                                        Tags      = new List <string>(),
                                        Character = new List <string>()
                                    };
                                    we = 7;
                                    if (j["n"] != null)
                                    {
                                        g.Title = j["n"].ToString();
                                    }
                                    if (j["id"] != null)
                                    {
                                        g.ID = j["id"].ToString();
                                    }
                                    if (j["g"] != null)
                                    {
                                        g.Uploader = j["g"].ToString().Split('\"')[1];
                                    }
                                    if (j["type"] != null)
                                    {
                                        g.Type = j["type"].ToString();
                                    }
                                    if (j["l"] != null)
                                    {
                                        g.Language = j["l"].ToString();
                                    }
                                    if (j["p"] != null)
                                    {
                                        g.Series = j["p"].ToString().Split('\"')[1];
                                    }
                                    if (j["a"] != null)
                                    {
                                        g.Artist = j["a"].ToString();
                                    }

                                    if (j["t"] != null)
                                    {
                                        foreach (var value in j["t"].Values <string>())
                                        {
                                            g.Tags.Add(value);
                                        }
                                    }
                                    if (j["c"] != null)
                                    {
                                        foreach (var value in j["c"].Values <string>())
                                        {
                                            g.Character.Add(value);
                                        }
                                    }
                                    g.ThumnailImage = "https://ltn.hitomi.la/galleryblock/" + g.ID + ".html";
                                    OnFind(g);
                                }
                            }

                            try
                            {
                                using (var draw = Bar.CreateGraphics())
                                    draw.DrawLine(new Pen(Color.FromArgb(100, 200, 100), Bar.Size.Height / 2), 0, Bar.Size.Height / 2.0f, Bar.Size.Width / 19.0f * i, Bar.Size.Height / 2.0f);
                            }
                            catch (Exception) { }

                            sr.Close();
                            GC.Collect();
                        }
                    }
                    catch (Exception e1)
                    {
                        MessageBox.Show(e1.ToString() + "\n\n\n" + we);
                    }
                }
            }
            text.Invoke(new MethodInvoker(() =>
            {
                text.Text = "검색";
            }));
        }
Ejemplo n.º 15
0
 private void OnFind(Gallerie e)
 {
     Find?.Invoke(this, e);
 }
Ejemplo n.º 16
0
 private void Hio_Downloads(object sender, Gallerie e, float Percentage)
 {
     OnDownload(e, Percentage);
 }
Ejemplo n.º 17
0
 private void OnDownload(Gallerie e, float f)
 {
     Downloads?.Invoke(this, e, f);
 }
Ejemplo n.º 18
0
 private void OnViewEvent(Gallerie e)
 {
     ViewEvent?.Invoke(this, e);
 }