알라딘 API 응답 처리 구조화 및 URL 브라우저 열기 개선

- AladinBookData 클래스 추가하여 API 응답 데이터 구조화
- ToString() 메서드 오버라이드로 파이프 구분자 형식 출력 지원
- Aladin_struct() 메서드 추가: List<AladinBookData> 반환
- 기존 Aladin() 메서드는 호환성 유지를 위해 보존
- URL 링크 클릭 시 탐색기 대신 기본 웹 브라우저로 열리도록 수정 (UseShellExecute = true)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-29 23:15:04 +09:00
parent a36372b17c
commit e4b8ead056
5 changed files with 567 additions and 208 deletions

View File

@@ -29,12 +29,29 @@ namespace ISBN_Check_test
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.cb_filter = new System.Windows.Forms.ComboBox();
this.button1 = new System.Windows.Forms.Button();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.label1 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.start_idx = new System.Windows.Forms.TextBox();
this.end_idx = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.cb_api = new System.Windows.Forms.ComboBox();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.btn_Yes24 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.button3 = new System.Windows.Forms.Button();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.button4 = new System.Windows.Forms.Button();
this.tbDelay = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.book_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.author = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.book_comp = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -46,19 +63,8 @@ namespace ISBN_Check_test
this.sold_out = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.count = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.label1 = new System.Windows.Forms.Label();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.start_idx = new System.Windows.Forms.TextBox();
this.end_idx = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.cb_api = new System.Windows.Forms.ComboBox();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.btn_Yes24 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.button3 = new System.Windows.Forms.Button();
this.dvc_link = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.dvc_remark = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
@@ -77,7 +83,7 @@ namespace ISBN_Check_test
//
// button1
//
this.button1.Location = new System.Drawing.Point(388, 9);
this.button1.Location = new System.Drawing.Point(530, 11);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 2;
@@ -87,14 +93,14 @@ namespace ISBN_Check_test
//
// dataGridView1
//
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle7.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle1.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.book_name,
this.author,
@@ -106,28 +112,203 @@ namespace ISBN_Check_test
this.category,
this.sold_out,
this.Column1,
this.count});
this.count,
this.dvc_link,
this.dvc_remark});
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnF2;
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
this.dataGridView1.Name = "dataGridView1";
dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle9.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle3.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle3;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.dataGridView1.Size = new System.Drawing.Size(1001, 471);
this.dataGridView1.Size = new System.Drawing.Size(1309, 471);
this.dataGridView1.TabIndex = 3;
this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);
this.dataGridView1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint);
this.dataGridView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView1_KeyDown);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(1046, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 4;
this.label1.Text = "00:00:00.00";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(1309, 100);
this.richTextBox1.TabIndex = 5;
this.richTextBox1.Text = "";
//
// start_idx
//
this.start_idx.Location = new System.Drawing.Point(272, 11);
this.start_idx.Name = "start_idx";
this.start_idx.Size = new System.Drawing.Size(42, 21);
this.start_idx.TabIndex = 6;
this.start_idx.Text = "1";
this.start_idx.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
//
// end_idx
//
this.end_idx.Location = new System.Drawing.Point(340, 11);
this.end_idx.Name = "end_idx";
this.end_idx.Size = new System.Drawing.Size(42, 21);
this.end_idx.TabIndex = 6;
this.end_idx.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(320, 15);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(14, 12);
this.label2.TabIndex = 4;
this.label2.Text = "~";
//
// button2
//
this.button2.Location = new System.Drawing.Point(609, 11);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 2;
this.button2.Text = "리 셋";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// cb_api
//
this.cb_api.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cb_api.FormattingEnabled = true;
this.cb_api.Location = new System.Drawing.Point(12, 10);
this.cb_api.Name = "cb_api";
this.cb_api.Size = new System.Drawing.Size(121, 20);
this.cb_api.TabIndex = 0;
this.cb_api.SelectedIndexChanged += new System.EventHandler(this.cb_api_SelectedIndexChanged);
//
// progressBar1
//
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.Location = new System.Drawing.Point(1113, 10);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(184, 23);
this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.progressBar1.TabIndex = 7;
//
// btn_Yes24
//
this.btn_Yes24.Location = new System.Drawing.Point(767, 11);
this.btn_Yes24.Name = "btn_Yes24";
this.btn_Yes24.Size = new System.Drawing.Size(75, 23);
this.btn_Yes24.TabIndex = 8;
this.btn_Yes24.Text = "Yes반출";
this.btn_Yes24.UseVisualStyleBackColor = true;
this.btn_Yes24.Click += new System.EventHandler(this.btn_Yes24_Click);
//
// panel1
//
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.tbDelay);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.button4);
this.panel1.Controls.Add(this.button3);
this.panel1.Controls.Add(this.cb_api);
this.panel1.Controls.Add(this.btn_Yes24);
this.panel1.Controls.Add(this.cb_filter);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.progressBar1);
this.panel1.Controls.Add(this.button2);
this.panel1.Controls.Add(this.end_idx);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.start_idx);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1309, 47);
this.panel1.TabIndex = 9;
//
// button3
//
this.button3.Location = new System.Drawing.Point(688, 11);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 9;
this.button3.Text = "리셋(전체)";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// panel2
//
this.panel2.Controls.Add(this.richTextBox1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(0, 518);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1309, 100);
this.panel2.TabIndex = 10;
//
// panel3
//
this.panel3.Controls.Add(this.dataGridView1);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 47);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(1309, 471);
this.panel3.TabIndex = 11;
//
// button4
//
this.button4.Location = new System.Drawing.Point(848, 11);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(75, 23);
this.button4.TabIndex = 10;
this.button4.Text = "목록초기화";
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// tbDelay
//
this.tbDelay.Location = new System.Drawing.Point(454, 12);
this.tbDelay.Name = "tbDelay";
this.tbDelay.Size = new System.Drawing.Size(42, 21);
this.tbDelay.TabIndex = 12;
this.tbDelay.Text = "500";
this.tbDelay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(398, 17);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(53, 12);
this.label3.TabIndex = 11;
this.label3.Text = "지연시간";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(502, 17);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(23, 12);
this.label4.TabIndex = 13;
this.label4.Text = "ms";
//
// book_name
//
this.book_name.HeaderText = "도서명";
@@ -187,147 +368,27 @@ namespace ISBN_Check_test
//
// count
//
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.count.DefaultCellStyle = dataGridViewCellStyle8;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
this.count.DefaultCellStyle = dataGridViewCellStyle2;
this.count.HeaderText = "검색갯수";
this.count.Name = "count";
this.count.Width = 80;
//
// label1
// dvc_link
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(719, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 4;
this.label1.Text = "00:00:00.00";
this.label1.Click += new System.EventHandler(this.label1_Click);
this.dvc_link.HeaderText = "URL";
this.dvc_link.Name = "dvc_link";
//
// richTextBox1
// dvc_remark
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(1001, 100);
this.richTextBox1.TabIndex = 5;
this.richTextBox1.Text = "";
//
// start_idx
//
this.start_idx.Location = new System.Drawing.Point(272, 11);
this.start_idx.Name = "start_idx";
this.start_idx.Size = new System.Drawing.Size(42, 21);
this.start_idx.TabIndex = 6;
this.start_idx.Text = "1";
this.start_idx.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
//
// end_idx
//
this.end_idx.Location = new System.Drawing.Point(340, 11);
this.end_idx.Name = "end_idx";
this.end_idx.Size = new System.Drawing.Size(42, 21);
this.end_idx.TabIndex = 6;
this.end_idx.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(320, 15);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(14, 12);
this.label2.TabIndex = 4;
this.label2.Text = "~";
//
// button2
//
this.button2.Location = new System.Drawing.Point(467, 9);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 2;
this.button2.Text = "리 셋";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// cb_api
//
this.cb_api.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cb_api.FormattingEnabled = true;
this.cb_api.Location = new System.Drawing.Point(12, 10);
this.cb_api.Name = "cb_api";
this.cb_api.Size = new System.Drawing.Size(121, 20);
this.cb_api.TabIndex = 0;
this.cb_api.SelectedIndexChanged += new System.EventHandler(this.cb_api_SelectedIndexChanged);
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(786, 10);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(184, 23);
this.progressBar1.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.progressBar1.TabIndex = 7;
//
// btn_Yes24
//
this.btn_Yes24.Location = new System.Drawing.Point(625, 9);
this.btn_Yes24.Name = "btn_Yes24";
this.btn_Yes24.Size = new System.Drawing.Size(75, 23);
this.btn_Yes24.TabIndex = 8;
this.btn_Yes24.Text = "Yes반출";
this.btn_Yes24.UseVisualStyleBackColor = true;
this.btn_Yes24.Click += new System.EventHandler(this.btn_Yes24_Click);
//
// panel1
//
this.panel1.Controls.Add(this.button3);
this.panel1.Controls.Add(this.cb_api);
this.panel1.Controls.Add(this.btn_Yes24);
this.panel1.Controls.Add(this.cb_filter);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.progressBar1);
this.panel1.Controls.Add(this.button2);
this.panel1.Controls.Add(this.end_idx);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.start_idx);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(1001, 47);
this.panel1.TabIndex = 9;
//
// panel2
//
this.panel2.Controls.Add(this.richTextBox1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(0, 518);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(1001, 100);
this.panel2.TabIndex = 10;
//
// panel3
//
this.panel3.Controls.Add(this.dataGridView1);
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 47);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(1001, 471);
this.panel3.TabIndex = 11;
//
// button3
//
this.button3.Location = new System.Drawing.Point(546, 9);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.TabIndex = 9;
this.button3.Text = "리셋(전체)";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
this.dvc_remark.HeaderText = "비고";
this.dvc_remark.Name = "dvc_remark";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1001, 618);
this.ClientSize = new System.Drawing.Size(1309, 618);
this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
@@ -358,6 +419,14 @@ namespace ISBN_Check_test
private System.Windows.Forms.ComboBox cb_api;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Button btn_Yes24;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox tbDelay;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.DataGridViewTextBoxColumn book_name;
private System.Windows.Forms.DataGridViewTextBoxColumn author;
private System.Windows.Forms.DataGridViewTextBoxColumn book_comp;
@@ -369,10 +438,8 @@ namespace ISBN_Check_test
private System.Windows.Forms.DataGridViewTextBoxColumn sold_out;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn count;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.DataGridViewTextBoxColumn dvc_link;
private System.Windows.Forms.DataGridViewTextBoxColumn dvc_remark;
}
}

View File

@@ -11,6 +11,8 @@ using System.Threading;
using System.Windows.Forms;
using WindowsFormsApp1;
using System.Text.RegularExpressions;
using System.Diagnostics.Eventing.Reader;
using Org.BouncyCastle.Pkcs;
namespace ISBN_Check_test
{
@@ -25,8 +27,15 @@ namespace ISBN_Check_test
}
private void Form1_Load(object sender, EventArgs e)
{
this.Show();
Application.DoEvents();
string[] api_list = { "다음", "네이버", "알라딘" };
cb_api.Items.AddRange(api_list);
cb_api.SelectedIndex = 2;
Application.DoEvents();
cb_filter_SelectedIndexChanged(null, null);
Application.DoEvents();
}
private void button2_Click(object sender, EventArgs e)
{
@@ -45,8 +54,16 @@ namespace ISBN_Check_test
if (cb_api.SelectedIndex == -1) { MessageBox.Show("조건이 선택되지 않았습니다."); return; }
if (cb_filter.SelectedIndex == -1) { MessageBox.Show("조건이 선택되지 않았습니다."); return; }
this.dataGridView1.AutoResizeColumn(3);
this.Refresh();
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
if (int.TryParse(tbDelay.Text, out int delayms) == false)
{
MessageBox.Show("지연시간 입력 오류");
return;
}
var sistr = start_idx.Text.Trim();
var eistr = end_idx.Text.Trim();
@@ -69,7 +86,7 @@ namespace ISBN_Check_test
ei = ei - 1;
si = si - 1;
if(si < 0 || ei <0)
if (si < 0 || ei < 0)
{
MessageBox.Show("시작,종료번호를 확인하세요");
return;
@@ -97,7 +114,7 @@ namespace ISBN_Check_test
Naver_API(dataGridView1, si, ei);
break;
case 2:
Aladin_API(dataGridView1, si, ei);
Aladin_API(dataGridView1, si, ei, delayms);
break;
}
@@ -119,7 +136,7 @@ namespace ISBN_Check_test
/// 알라딘 API
/// </summary>
/// <param name="gridview"></param>
private void Aladin_API(DataGridView gridview, int start, int end)
private void Aladin_API(DataGridView gridview, int start, int end, int delayms)
{
// 도서명 / 저자 / 출판사 / isbn / 정가
// 발행일 / 도서분류 / 재고
@@ -152,25 +169,32 @@ namespace ISBN_Check_test
break;
}
// string query = dataGridView1.Rows[a].Cells["isbn"].Value?.ToString() ?? string.Empty;
string query = Set_query(type, a ); //a=는줄번호이고 idx는 -1 해야함
string query = Set_query(type, a); //a=는줄번호이고 idx는 -1 해야함
if (gridview.Rows[a].DefaultCellStyle.BackColor == Color.Yellow)
continue;
else if (gridview.Rows[a ].DefaultCellStyle.BackColor == Color.LightGray)
gridview.Rows[a ].DefaultCellStyle.BackColor = Color.Empty;
else if (gridview.Rows[a].DefaultCellStyle.BackColor == Color.LightGray)
gridview.Rows[a].DefaultCellStyle.BackColor = Color.Empty;
// string aladin = api.Aladin(query, "ISBN13", param);
var aladin = api.Aladin(query, type, param);
insert_By_Aladin(aladin, a);
try
{
var sb = new StringBuilder();
foreach(var item in aladin)
{
sb.AppendLine(string.Join("|", item));
}
richTextBox1.Text = sb.ToString();
}
catch { }
//var aladin = api.Aladin(query, type, param);
var aladin_struct = api.Aladin_struct(query, type, out string xmlString);
insert_By_Aladin(aladin_struct, a, xmlString);
if (aladin_struct.Any())
richTextBox1.Text = aladin_struct.First().ToString();
else
richTextBox1.Text = "No Data";
System.Threading.Thread.Sleep(delayms);
//try
//{
// var sb = new StringBuilder();
// foreach (var item in aladin)
// {
// sb.AppendLine(string.Join("|", item));
// }
// richTextBox1.Text = aladin_struct.ToString();// sb.ToString();
//}
//catch { }
}
}
string Set_query(string type, int idx)
@@ -314,13 +338,60 @@ namespace ISBN_Check_test
{
progressBar1.PerformStep();
}
void insert_By_Aladin(string[] insert, int row)
void insert_By_Aladin(List<AladinBookData> insert, int row, string xmlString)
{
if (row >0)
if (row > 0)
{
dataGridView1.Rows[row - 1].Selected = false;
}
dataGridView1.Rows[row ].Selected = true;
dataGridView1.Rows[row].Selected = true;
//데이터가 없다면 처리하지 않는다.
if (insert.Any() == false)
{
dataGridView1.Rows[row].Cells["count"].Value = "0";
dataGridView1.Rows[row].Cells["dvc_remark"].Value = $"No Data\n{xmlString}";
return;
}
var item = insert.First();
// pubDate형 보기편하게 DateTime형으로 재정리
string pubdate = item.PubDate;
try
{
//pubdate = item.PubDate;
pubdate = String.Format("{0:yyyy/MM/dd}",
DateTime.Parse(pubdate.Remove(pubdate.IndexOf(" G"))));
}
catch (Exception ex) { MessageBox.Show(item.ToString()); }
//카테고리명 정리
item.CategoryName = Aladin_CategorySort(item.CategoryName);
//for (int a = 0; a < insert.Length; a++)
//{
// if (a % 8 == 6) { insert[a] = Aladin_CategorySort(insert[a]); }
//}
dataGridView1.Rows[row].Cells["Column1"].Value += item.ToString();// string.Join("|", insert) + "|";
if (item.Description.StartsWith("<")) item.Description = item.Description.Substring(item.Description.IndexOf(">")+1);
dataGridView1.Rows[row].Cells["dvc_remark"].Value = item.Description;// $"{insert.Count}건";
dataGridView1.Rows[row].Cells["dvc_link"].Value = $"{item.Link}";
dataGridView1.Rows[row].Cells["count"].Value = $"{insert.Count}";
dataGridView1.Rows[row].DefaultCellStyle.BackColor = Color.LightGray;
if (cb_filter.SelectedItem.ToString() == "별치조사")
input_api_aladin(item, row, pubdate);
input_api(item, row, pubdate);
}
void insert_By_Aladin(string[] insert, int row)
{
if (row > 0)
{
dataGridView1.Rows[row - 1].Selected = false;
}
dataGridView1.Rows[row].Selected = true;
if (insert.Any() == false) { return; }
@@ -332,7 +403,7 @@ namespace ISBN_Check_test
newstring = String.Format("{0:yyyy/MM/dd}",
DateTime.Parse(insert[5].Remove(insert[5].IndexOf(" G"))));
}
catch (Exception ex) { MessageBox.Show(string.Join("|",insert)); }
catch (Exception ex) { MessageBox.Show(string.Join("|", insert)); }
for (int a = 0; a < insert.Length; a++)
{
@@ -357,6 +428,17 @@ namespace ISBN_Check_test
return insert;
}
void input_api_aladin(AladinBookData data, int row, string date)
{
dataGridView1.Rows[row].Cells["book_name"].Value = data.Title;
dataGridView1.Rows[row].Cells["author"].Value = data.Author;
dataGridView1.Rows[row].Cells["book_comp"].Value = data.Publisher;
dataGridView1.Rows[row].Cells["price2"].Value = data.PriceStandard;
dataGridView1.Rows[row].Cells["pubDate"].Value = date;
dataGridView1.Rows[row].Cells["category"].Value = data.CategoryName;
}
void input_api_aladin(string[] data, int row, string date)
{
dataGridView1.Rows[row].Cells["book_name"].Value = data[0];
@@ -368,7 +450,7 @@ namespace ISBN_Check_test
}
void insert_By_Naver(string value, int row)
{
if (row > 0) { dataGridView1.Rows[row -1].Selected = false; }
if (row > 0) { dataGridView1.Rows[row - 1].Selected = false; }
dataGridView1.Rows[row].Selected = true;
if (value == "") return;
@@ -479,6 +561,46 @@ namespace ISBN_Check_test
input_api(grid, row, newstring);
}
void input_api(AladinBookData value, int idx, string date)
{
//string[] param = { "title", "authors", "publisher", "isbn", "price",
// "datetime", "status" };
//string[] param = { "title", "author", "publisher", "isbn13", "priceStandard",
// "pubDate", "categoryName", "stockStatus", };
bool[] chk = { false, false, false };
string book_name = dataGridView1.Rows[idx].Cells["book_name"].Value?.ToString() ?? string.Empty;
string author = dataGridView1.Rows[idx].Cells["author"].Value?.ToString() ?? string.Empty;
string book_comp = dataGridView1.Rows[idx].Cells["book_comp"].Value?.ToString() ?? string.Empty;
if (value.Title == book_name) chk[0] = true;
if (value.Author.Contains(author) == true) chk[1] = true;
else if (author.Contains(value.Author) == true) chk[1] = true;
else if (value.Author == author) chk[1] = true;
if (value.Publisher.Contains(book_comp) == true) chk[2] = true;
else if (book_comp.Contains(value.Publisher) == true) chk[2] = true;
else if (value.Publisher == book_comp) chk[2] = true;
if (chk[0] == true && chk[1] == true && chk[2] == true)
{
dataGridView1.Rows[idx].Cells["isbn"].Value = value.Isbn13;
dataGridView1.Rows[idx].Cells["price2"].Value = value.PriceStandard;
dataGridView1.Rows[idx].Cells["pubDate"].Value = date;
//if (cb_api.SelectedIndex == 2)
dataGridView1.Rows[idx].Cells["category"].Value = value.CategoryName;
dataGridView1.Rows[idx].Cells["sold_out"].Value = value.StockStatus;
dataGridView1.Rows[idx].DefaultCellStyle.BackColor = Color.Yellow;
}
count_res();
}
/// <summary>
/// API에서 가져온 데이터가 요구한 데이터와 일치하는지 알아보는 함수
/// </summary>
@@ -519,15 +641,15 @@ namespace ISBN_Check_test
#region
private void count_res()
{
String_Text st = new String_Text();
int count = dataGridView1.Rows.Count;
for (int a = 0; a < count; a++)
{
string search_data = dataGridView1.Rows[a].Cells["Column1"].Value?.ToString() ?? string.Empty;
int tmp_count = st.Char_count(search_data, '|');
int lcount = tmp_count / 8;
dataGridView1.Rows[a].Cells["count"].Value = lcount.ToString();
}
//String_Text st = new String_Text();
//int count = dataGridView1.Rows.Count;
//for (int a = 0; a < count; a++)
//{
// string search_data = dataGridView1.Rows[a].Cells["Column1"].Value?.ToString() ?? string.Empty;
// int tmp_count = st.Char_count(search_data, '|');
// int lcount = tmp_count / 8;
// dataGridView1.Rows[a].Cells["count"].Value = lcount.ToString();
//}
}
#endregion
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
@@ -574,13 +696,50 @@ namespace ISBN_Check_test
}
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Rows[rowidx].Cells["Column1"].Value == null ||
dataGridView1.Rows[rowidx].Cells["Column1"].Value.ToString() == "") { return; }
if (e.RowIndex < 0 || e.ColumnIndex < 0) return;
var column = this.dataGridView1.Columns[e.ColumnIndex];
if (column.Name.Equals("dvc_remark"))
{
var value = this.dataGridView1.Rows[e.RowIndex].Cells[column.Name].Value?.ToString() ?? string.Empty;
if(value.StartsWith("<"))
{
value = value.Substring(value.IndexOf(">") + 1);
}
else this.richTextBox1.Text = value;
}
else if (column.Name.Equals("Column"))
{
var value = this.dataGridView1.Rows[e.RowIndex].Cells[column.Name].Value?.ToString() ?? string.Empty;
if (value == string.Empty) return;
Form2 f2 = new Form2(this);
f2.row = rowidx;
f2.Call_API = cb_api.Text;
f2.Show();
}
else if (column.Name.Equals("dvc_link"))
{
var value = this.dataGridView1.Rows[e.RowIndex].Cells[column.Name].Value?.ToString() ?? string.Empty;
if (value == string.Empty) return;
try
{
var prc = new System.Diagnostics.Process();
prc.StartInfo = new System.Diagnostics.ProcessStartInfo()
{
FileName = value,
UseShellExecute = true
};
prc.Start();
}
catch (Exception ex)
{
}
}
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
@@ -606,6 +765,7 @@ namespace ISBN_Check_test
{
string[] aladin = { "도서명 + 저자", "도서명", "저자", "출판사", "별치조사" };
cb_filter.Items.AddRange(aladin);
cb_filter.SelectedIndex = cb_filter.Items.Count - 1;
}
Must_Col(cb_api.SelectedIndex);
}
@@ -675,5 +835,10 @@ namespace ISBN_Check_test
}
}
}
private void button4_Click(object sender, EventArgs e)
{
dataGridView1.Rows.Clear();
}
}
}

View File

@@ -150,4 +150,10 @@
<metadata name="count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dvc_link.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dvc_remark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@@ -14,6 +14,41 @@ using System.Xml.Linq;
namespace ISBN_Check_test
{
/// <summary>
/// 알라딘 API 응답 데이터 구조체
/// </summary>
public class AladinBookData
{
public string Title { get; set; }
public string Link { get; set; }
public string Author { get; set; }
public string PubDate { get; set; }
public string Description { get; set; }
public string Isbn { get; set; }
public string Isbn13 { get; set; }
public string PriceSales { get; set; }
public string PriceStandard { get; set; }
public string StockStatus { get; set; }
public string Mileage { get; set; }
public string Cover { get; set; }
public string CategoryId { get; set; }
public string CategoryName { get; set; }
public string Publisher { get; set; }
public string CustomerReviewRank { get; set; }
public string FullDescription { get; set; }
public string FullDescription2 { get; set; }
public string ItemId { get; set; }
/// <summary>
/// 지정된 필드들을 "|" 구분자로 출력
/// </summary>
/// <returns></returns>
public override string ToString()
{
return $"{Title}|{Author}|{Publisher}|{Isbn13}|{PriceStandard}|{PubDate}|{CategoryName}|{StockStatus}";
}
}
class API
{
/// <summary>
@@ -85,6 +120,92 @@ namespace ISBN_Check_test
}
return new string[] { };
}
/// <summary>
/// https://blog.aladin.co.kr/openapi 참고 (구조체 반환 버전)
/// </summary>
/// <param name="Query"></param>
/// <param name="QueryType"></param>
/// <returns>AladinBookData 리스트</returns>
public List<AladinBookData> Aladin_struct(string Query, string QueryType,out string xml)
{
// 쿼리 생성
string key = "ttbgloriabook1512001";
string site = "http://www.aladin.co.kr/ttb/api/ItemSearch.aspx";
string query = string.Format("{0}?query={1}&TTBKey={2}&output=xml&querytype={3}&MaxResults={4}",
site, Query, key, QueryType, 30.ToString());
xml = string.Empty;
try
{
// 쿼리를 입력인자로 WebRequest 개채 생성
WebRequest request = WebRequest.Create(query);
// WebResponse개체를 통해 서비스 요청.
WebResponse response = request.GetResponse();
// 결과문자열 확인
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
xml = reader.ReadToEnd();
stream.Close();
var xdoc = XDocument.Parse(xml);
// XML에서 직접 totalResults와 item 추출 (XDocument 사용)
XNamespace ns = "http://www.aladin.co.kr/ttb/apiguide.aspx";
// totalResults 추출
string totalResults = xdoc.Descendants(ns + "totalResults").FirstOrDefault()?.Value ?? "0";
// item들 추출
var itemElements = xdoc.Descendants(ns + "item");
List<AladinBookData> resultList = new List<AladinBookData>();
if (!itemElements.Any())
{
Console.WriteLine(Query);
return resultList;
}
// 모든 item을 순회하며 리스트에 추가
foreach (var itemElement in itemElements)
{
AladinBookData bookData = new AladinBookData
{
ItemId = itemElement.Attribute("itemId")?.Value ?? "",
Title = itemElement.Element(ns + "title")?.Value ?? "",
Link = itemElement.Element(ns + "link")?.Value ?? "",
Author = itemElement.Element(ns + "author")?.Value ?? "",
PubDate = itemElement.Element(ns + "pubDate")?.Value ?? "",
Description = itemElement.Element(ns + "description")?.Value ?? "",
Isbn = itemElement.Element(ns + "isbn")?.Value ?? "",
Isbn13 = itemElement.Element(ns + "isbn13")?.Value ?? "",
PriceSales = itemElement.Element(ns + "priceSales")?.Value ?? "",
PriceStandard = itemElement.Element(ns + "priceStandard")?.Value ?? "",
StockStatus = itemElement.Element(ns + "stockStatus")?.Value ?? "",
Mileage = itemElement.Element(ns + "mileage")?.Value ?? "",
Cover = itemElement.Element(ns + "cover")?.Value ?? "",
CategoryId = itemElement.Element(ns + "categoryId")?.Value ?? "",
CategoryName = itemElement.Element(ns + "categoryName")?.Value ?? "",
Publisher = itemElement.Element(ns + "publisher")?.Value ?? "",
CustomerReviewRank = itemElement.Element(ns + "customerReviewRank")?.Value ?? "",
FullDescription = itemElement.Element(ns + "fulldescription")?.Value ?? "",
FullDescription2 = itemElement.Element(ns + "fulldescription2")?.Value ?? ""
};
resultList.Add(bookData);
}
return resultList;
}
catch (Exception ex)
{
// 에러 발생 시 빈 리스트 반환
return new List<AladinBookData>();
}
}
/// <summary>
/// https://blog.aladin.co.kr/openapi 참고
/// </summary>

View File

@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
[assembly: AssemblyVersion("25.09.24.2340")]
[assembly: AssemblyVersion("25.10.29.2300")]
// [assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("25.09.24.2340")]
[assembly: AssemblyFileVersion("25.10.29.2300")]