示例#1
0
        private static void Main(string[] args)
        {
            var results = NaverWebtoon
                          .Search("갓오하")
                          .Select(result => $"{result.Name}({result.Id})");

            foreach (string s in results)
            {
                Console.Out.WriteLine(s);
            }
        }
        private void CallGetSpecificWebtoonDetailPageInformations(int num, Action <NaverWebtoon.WebtoonDetailPageInformations> callback)
        {
            Task.Factory.StartNew(() =>
            {
                NaverWebtoon.WebtoonDetailPageInformations?info = NaverWebtoon.GetSpecificWebtoonDetailPageInformations(this.url.Replace("list.nhn?", "detail.nhn?"), num);

                if (info.HasValue)
                {
                    if (this.InvokeRequired)
                    {
                        this.Invoke(new Action(() => callback.Invoke(info.Value)));
                    }
                    else
                    {
                        callback.Invoke(info.Value);
                    }
                }
            });
        }
        private void WebtoonDownloadOptionForm_Shown(object sender, EventArgs e)
        {
            this.DotAnimationTimer.Start( );

            this.LOADING_LABEL.Visible         = true;
            this.DOWNLOAD_OPTION_PANEL.Visible = false;

            this.BGM_DOWNLOAD_CHECKBOX.Visible = false;
            this.BGM_DOWNLOAD_LABEL.Visible    = false;

            this.CREATE_VIEWER_CHECKBOX.Visible = false;
            this.CREATE_VIEWER_LABEL.Visible    = false;

            this.DOWNLOAD_BUTTON.Visible = false;

            Task.Factory.StartNew(async( ) =>
            {
                int maxWebtoonList = NaverWebtoon.GetWebtoonListCount(this.url);

                if (maxWebtoonList > 0)
                {
                    CallGetSpecificWebtoonDetailPageInformations(1, (NaverWebtoon.WebtoonDetailPageInformations info) =>
                    {
                        this.BEGIN_THUMBNAIL_IMAGE.Load(info.thumbnail);
                        this.BEGIN_TITLE_LABEL.Text = info.title;
                    });

                    await Task.Delay(1000);

                    CallGetSpecificWebtoonDetailPageInformations(maxWebtoonList, (NaverWebtoon.WebtoonDetailPageInformations info) =>
                    {
                        this.END_THUMBNAIL_IMAGE.Load(info.thumbnail);
                        this.END_TITLE_LABEL.Text = info.title;
                    });

                    if (this.InvokeRequired)
                    {
                        this.Invoke(new Action(() =>
                        {
                            this.DotAnimationTimer.Stop( );

                            this.LOADING_LABEL.Visible         = false;
                            this.DOWNLOAD_OPTION_PANEL.Visible = true;
                            this.QUALITY_OPTION_PANEL.Visible  = true;

                            this.BGM_DOWNLOAD_CHECKBOX.Visible = true;
                            this.BGM_DOWNLOAD_LABEL.Visible    = true;

                            this.CREATE_VIEWER_CHECKBOX.Visible = true;
                            this.CREATE_VIEWER_LABEL.Visible    = true;

                            this.DOWNLOAD_BUTTON.Visible = true;

                            this.WEBTOON_BEGIN_NUMBER.Minimum = 1;
                            this.WEBTOON_BEGIN_NUMBER.Maximum = maxWebtoonList + 1;
                            this.WEBTOON_BEGIN_NUMBER.Value   = 1;

                            this.WEBTOON_END_NUMBER.Maximum = maxWebtoonList;
                            this.WEBTOON_END_NUMBER.Value   = maxWebtoonList;
                        }));
                    }
                    else
                    {
                        this.DotAnimationTimer.Stop( );

                        this.LOADING_LABEL.Visible         = false;
                        this.DOWNLOAD_OPTION_PANEL.Visible = true;
                        this.QUALITY_OPTION_PANEL.Visible  = true;

                        this.BGM_DOWNLOAD_CHECKBOX.Visible = true;
                        this.BGM_DOWNLOAD_LABEL.Visible    = true;

                        this.CREATE_VIEWER_CHECKBOX.Visible = true;
                        this.CREATE_VIEWER_LABEL.Visible    = true;

                        this.DOWNLOAD_BUTTON.Visible = true;

                        this.WEBTOON_BEGIN_NUMBER.Minimum = 1;
                        this.WEBTOON_BEGIN_NUMBER.Maximum = maxWebtoonList + 1;
                        this.WEBTOON_BEGIN_NUMBER.Value   = 1;

                        this.WEBTOON_END_NUMBER.Maximum = maxWebtoonList;
                        this.WEBTOON_END_NUMBER.Value   = maxWebtoonList;
                    }
                }
                else
                {
                    NotifyBox.Show(this, "오류", "Error", "웹툰 정보를 가져올 수 없습니다.", NotifyBox.NotifyBoxType.OK, NotifyBox.NotifyBoxIcon.Error);
                }
            });
        }
示例#4
0
        private void SEARCH_BUTTON_Click(object sender, EventArgs e)
        {
            if (UIModeVar == UIMode.QuestionIsRight)
            {
                this.Opacity = 0;

                WebtoonDownloadOptionForm form = new WebtoonDownloadOptionForm(this.SelectedInformationBuffer.Value.url);
                form.ShowDialog( );

                this.Opacity = 1;

                if (form.ForceClosed)
                {
                    this.Close( );
                    return;
                }

                GlobalVar.GlobalListPageInformations = this.SelectedInformationBuffer;
                this.Close( );
            }
            else
            {
                string searchString = this.DATA_TEXTBOX.Text;

                if (searchString.Length <= 0)
                {
                    NotifyBox.Show(this, "오류", "Error", "다운로드 할 웹툰의 주소나 이름을 입력하세요.", NotifyBox.NotifyBoxType.OK, NotifyBox.NotifyBoxIcon.Error);
                    return;
                }

                // ** 버그 리스트 **
                // 현재 url 끝에 # 이 붙어있으면 프로그램이 잠시 멈추는 문제가 있음

                // 입력한 정보가 URL 인지 웹툰 제목인지 확인한 후 작업 실시
                if (Regex.IsMatch(searchString, @"^http(s)?://([\w-]+.)+[\w-]+(/[\w- ./?%&=])?$"))
                {
                    if (NaverWebtoon.IsValidWebtoonListURL(ref searchString))
                    {
                        this.UIModeVar = UIMode.LoadingInformation;

                        Thread thread = new Thread(() =>
                        {
                            NaverWebtoon.WebtoonListPageInformations?informations = NaverWebtoon.GetWebtoonListPageInformations(searchString);

                            if (informations.HasValue)
                            {
                                this.SelectedInformationBuffer = informations.Value;

                                this.UIModeVar = UIMode.QuestionIsRight;
                                this.SELECTED_WEBTOON_INFORMATION_PANEL.SetData(this.SelectedInformationBuffer.Value);
                            }
                            else
                            {
                                this.UIModeVar = UIMode.NotSelected;
                                NotifyBox.Show(this, "오류", "Error", "죄송합니다, 해당 웹툰의 정보를 가져올 수 없었습니다.", NotifyBox.NotifyBoxType.OK, NotifyBox.NotifyBoxIcon.Error);
                            }
                        })
                        {
                            IsBackground = true
                        };

                        thread.Start( );
                    }
                    else
                    {
                        NotifyBox.Show(this, "오류", "Error", "올바른 웹툰의 주소를 입력하세요.\n\nhttp://comic.naver.com/webtoon/list.nhn?titleId=679519 의 형식으로 입력하십시오.", NotifyBox.NotifyBoxType.OK, NotifyBox.NotifyBoxIcon.Error);
                    }
                }
                else
                {
                    WebtoonSearchForm form = new WebtoonSearchForm(searchString);
                    form.ShowDialog( );

                    if (!string.IsNullOrEmpty(form.urlSelected))
                    {
                        Task.Factory.StartNew(() =>
                        {
                            NaverWebtoon.WebtoonListPageInformations?informations = NaverWebtoon.GetWebtoonListPageInformations(form.urlSelected);

                            if (informations.HasValue)
                            {
                                this.SelectedInformationBuffer = informations.Value;

                                this.UIModeVar = UIMode.QuestionIsRight;
                                this.SELECTED_WEBTOON_INFORMATION_PANEL.SetData(this.SelectedInformationBuffer.Value);
                            }
                            else
                            {
                                this.UIModeVar = UIMode.NotSelected;
                                NotifyBox.Show(this, "오류", "Error", "죄송합니다, 해당 웹툰의 정보를 가져올 수 없었습니다.", NotifyBox.NotifyBoxType.OK, NotifyBox.NotifyBoxIcon.Error);
                            }
                        });
                    }
                }
            }
        }