Compare commits
16 Commits
d3d4b977e6
...
chi202506
| Author | SHA1 | Date | |
|---|---|---|---|
| e4b8ead056 | |||
| a36372b17c | |||
| 7d1286b7a7 | |||
| 2835f8d14e | |||
| bbc47c50db | |||
| 12f190a0b8 | |||
| 1ae2b93490 | |||
| 216311b558 | |||
|
|
c0e6c9039e | ||
|
|
65065442a1 | ||
| 8e7df6f68d | |||
| 8f74fb5557 | |||
|
|
0cc71611d0 | ||
| 405c1d9c46 | |||
|
|
e815c02feb | ||
|
|
e2ae5d2937 |
@@ -2,7 +2,16 @@
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(git add:*)",
|
||||
"WebFetch(domain:jnelib.jne.go.kr)"
|
||||
"WebFetch(domain:jnelib.jne.go.kr)",
|
||||
"Bash(node:*)",
|
||||
"Bash(npm --version)",
|
||||
"Bash(echo $OS)",
|
||||
"Bash(claude mcp:*)",
|
||||
"WebSearch",
|
||||
"WebSearch",
|
||||
"Bash(git commit:*)",
|
||||
"Bash(git config:*)",
|
||||
"Bash(git push:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
Binary file not shown.
Binary file not shown.
3
ISBN_Check/.vscode/settings.json
vendored
Normal file
3
ISBN_Check/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"dotnet.preferCSharpExtension": true
|
||||
}
|
||||
3
ISBN_Check/Main/.vscode/settings.json
vendored
Normal file
3
ISBN_Check/Main/.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"dotnet.preferCSharpExtension": true
|
||||
}
|
||||
390
ISBN_Check/Main/Form1.Designer.cs
generated
390
ISBN_Check/Main/Form1.Designer.cs
generated
@@ -29,12 +29,29 @@ namespace ISBN_Check_test
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = 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,18 +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.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();
|
||||
@@ -76,7 +83,7 @@ namespace ISBN_Check_test
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(416, 10);
|
||||
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;
|
||||
@@ -86,14 +93,14 @@ namespace ISBN_Check_test
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle4.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
|
||||
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,
|
||||
@@ -105,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";
|
||||
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle6.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle6;
|
||||
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 = "도서명";
|
||||
@@ -186,136 +368,27 @@ namespace ISBN_Check_test
|
||||
//
|
||||
// count
|
||||
//
|
||||
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.count.DefaultCellStyle = dataGridViewCellStyle5;
|
||||
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(503, 10);
|
||||
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(590, 10);
|
||||
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.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;
|
||||
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);
|
||||
@@ -346,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;
|
||||
@@ -357,9 +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.DataGridViewTextBoxColumn dvc_link;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dvc_remark;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
@@ -20,12 +22,20 @@ namespace ISBN_Check_test
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.dataGridView1.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2;
|
||||
this.Text = $"{Application.ProductName} ver {Application.ProductVersion}";
|
||||
}
|
||||
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)
|
||||
{
|
||||
@@ -44,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();
|
||||
@@ -68,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;
|
||||
@@ -96,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;
|
||||
}
|
||||
|
||||
@@ -118,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 / 정가
|
||||
// 발행일 / 도서분류 / 재고
|
||||
@@ -151,20 +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);
|
||||
string aladin = api.Aladin(query, type, param);
|
||||
insert_By_Aladin(aladin, a);
|
||||
try
|
||||
{
|
||||
richTextBox1.Text = aladin;
|
||||
}
|
||||
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)
|
||||
@@ -308,17 +338,63 @@ namespace ISBN_Check_test
|
||||
{
|
||||
progressBar1.PerformStep();
|
||||
}
|
||||
void insert_By_Aladin(string data, 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;
|
||||
|
||||
string[] insert = data.Split('|');
|
||||
//데이터가 없다면 처리하지 않는다.
|
||||
if (insert.Any() == false)
|
||||
{
|
||||
dataGridView1.Rows[row].Cells["count"].Value = "0";
|
||||
dataGridView1.Rows[row].Cells["dvc_remark"].Value = $"No Data\n{xmlString}";
|
||||
return;
|
||||
}
|
||||
|
||||
if (data == "") { 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; }
|
||||
|
||||
// pubDate형 보기편하게 DateTime형으로 재정리
|
||||
string newstring = "";
|
||||
@@ -327,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(data); }
|
||||
catch (Exception ex) { MessageBox.Show(string.Join("|", insert)); }
|
||||
|
||||
for (int a = 0; a < insert.Length; a++)
|
||||
{
|
||||
@@ -352,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];
|
||||
@@ -363,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;
|
||||
@@ -474,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>
|
||||
@@ -514,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)
|
||||
@@ -569,12 +696,49 @@ 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; }
|
||||
Form2 f2 = new Form2(this);
|
||||
f2.row = rowidx;
|
||||
f2.Call_API = cb_api.Text;
|
||||
f2.Show();
|
||||
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)
|
||||
@@ -601,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);
|
||||
}
|
||||
@@ -640,7 +805,8 @@ namespace ISBN_Check_test
|
||||
{
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
string[] lst = { "9791193110584",
|
||||
string[] lst = { "9788965427520",
|
||||
"9791193110584",
|
||||
"9791168672260",
|
||||
"9788993858396",
|
||||
"9791171200351",
|
||||
@@ -657,5 +823,22 @@ namespace ISBN_Check_test
|
||||
end_idx.Text = (this.dataGridView1.Rows.Count - 1).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void button3_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int a = 0; a < dataGridView1.Rows.Count - 1; a++)
|
||||
{
|
||||
//if (dataGridView1.Rows[a].DefaultCellStyle.BackColor != Color.Yellow)
|
||||
{
|
||||
dataGridView1.Rows[a].Cells["Column1"].Value = "";
|
||||
dataGridView1.Rows[a].DefaultCellStyle.BackColor = Color.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void button4_Click(object sender, EventArgs e)
|
||||
{
|
||||
dataGridView1.Rows.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
@@ -10,9 +10,45 @@ using System.Threading.Tasks;
|
||||
using System.Web.Script.Serialization;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
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>
|
||||
@@ -22,7 +58,7 @@ namespace ISBN_Check_test
|
||||
/// <param name="QueryType"></param>
|
||||
/// <param name="Param"></param>
|
||||
/// <returns></returns>
|
||||
public string Aladin(string Query, string QueryType, string[] Param)
|
||||
public string[] Aladin(string Query, string QueryType, string[] Param)
|
||||
{
|
||||
string result = string.Empty;
|
||||
// 쿼리 생성
|
||||
@@ -49,58 +85,127 @@ namespace ISBN_Check_test
|
||||
// xml형식을 json형식으로 변환
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.LoadXml(xml);
|
||||
var json = JsonConvert.SerializeXmlNode(doc);
|
||||
|
||||
// json형식 분석을 위해 JavaScriptSerializer 개체 생성
|
||||
JavaScriptSerializer js = new JavaScriptSerializer();
|
||||
var xdoc = XDocument.Parse(xml);
|
||||
var xroot = xdoc.Root;
|
||||
|
||||
// 런타임에 개체를 확인하여 사용할수 있는 dynamic을 이용해 역직렬화
|
||||
dynamic dob = js.Deserialize<dynamic>(json);
|
||||
// XML에서 직접 totalResults와 item 추출 (XDocument 사용)
|
||||
XNamespace ns = "http://www.aladin.co.kr/ttb/apiguide.aspx";
|
||||
|
||||
// "object"내에 있는것을 얻어오기 위해 다시 dynamic변수에 참조
|
||||
dynamic docs = "";
|
||||
try
|
||||
// totalResults 추출
|
||||
string totalResults = xdoc.Descendants(ns + "totalResults").FirstOrDefault()?.Value ?? "0";
|
||||
|
||||
// item들 추출
|
||||
var itemElements = xdoc.Descendants(ns + "item");
|
||||
|
||||
if (!itemElements.Any())
|
||||
{
|
||||
docs = dob["object"]["item"];
|
||||
return new string[] { };
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "";
|
||||
}
|
||||
int length = 0;
|
||||
|
||||
int length = itemElements.Count();
|
||||
int ID_length = Param.Length;
|
||||
|
||||
// 검색 결과가 1개 이하일 경우, 오류가 발생하여 try/catch문 사용.
|
||||
try
|
||||
// XML item들을 순회하면서 필요한 데이터 추출 (XDocument 사용)
|
||||
List<string[]> retval = new List<string[]>();
|
||||
foreach (var itemElement in itemElements)
|
||||
{
|
||||
// docs는 요소 컬렉션으로 object로 변환.
|
||||
object[] buf = docs;
|
||||
length = buf.Length;
|
||||
}
|
||||
catch
|
||||
{
|
||||
object buf = docs;
|
||||
length = 1;
|
||||
}
|
||||
for (int a = 0; a < length; a++)
|
||||
{
|
||||
List<string> tmp_data = new List<string>();
|
||||
string[] buffer = new string[ID_length];
|
||||
for (int b = 0; b < ID_length; b++)
|
||||
{
|
||||
if (length == 1)
|
||||
{
|
||||
tmp_data.Add(docs[Param[b]]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_data.Add(docs[a][Param[b]]);
|
||||
}
|
||||
result += tmp_data[b] + "|";
|
||||
buffer[b] = itemElement.Element(ns + Param[b])?.Value ?? "";
|
||||
}
|
||||
result += "\n";
|
||||
//retval.Add(buffer);
|
||||
return buffer;
|
||||
}
|
||||
return result;
|
||||
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>
|
||||
@@ -194,7 +299,7 @@ namespace ISBN_Check_test
|
||||
// url 생성
|
||||
string url = "https://openapi.naver.com/v1/search/book_adv?";
|
||||
|
||||
for(int a = 0; a < Query.Length; a++)
|
||||
for (int a = 0; a < Query.Length; a++)
|
||||
{
|
||||
url += string.Format("{0}={1}&", QueryType[a], Query[a]);
|
||||
}
|
||||
@@ -278,7 +383,7 @@ namespace ISBN_Check_test
|
||||
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
|
||||
string json = reader.ReadToEnd();
|
||||
stream.Close();
|
||||
|
||||
|
||||
JavaScriptSerializer js = new JavaScriptSerializer();
|
||||
dynamic dob = js.Deserialize<dynamic>(json);
|
||||
dynamic docs = dob["documents"];
|
||||
@@ -287,18 +392,20 @@ namespace ISBN_Check_test
|
||||
int length = buf.Length;
|
||||
int ID_length = Param.Length;
|
||||
|
||||
for(int a = 0; a < length; a++)
|
||||
for (int a = 0; a < length; a++)
|
||||
{
|
||||
List<object> tmp_data = new List<object>();
|
||||
for(int b = 0; b < ID_length; b++)
|
||||
for (int b = 0; b < ID_length; b++)
|
||||
{
|
||||
if (Param[b] == "authors") {
|
||||
if (Param[b] == "authors")
|
||||
{
|
||||
object[] tmp = docs[a][Param[b]];
|
||||
string tmp_str = string.Empty;
|
||||
for(int j = 0; j < tmp.Length; j++)
|
||||
for (int j = 0; j < tmp.Length; j++)
|
||||
{
|
||||
tmp_str += tmp[j];
|
||||
if (j < tmp.Length - 1) {
|
||||
if (j < tmp.Length - 1)
|
||||
{
|
||||
tmp_str += ", ";
|
||||
}
|
||||
}
|
||||
@@ -306,7 +413,8 @@ namespace ISBN_Check_test
|
||||
result += tmp_data[b] + "|";
|
||||
tmp_str = "";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
tmp_data.Add(docs[a][Param[b]]);
|
||||
result += tmp_data[b] + "|";
|
||||
}
|
||||
|
||||
@@ -41,15 +41,15 @@ namespace ISBN_Check_test
|
||||
|
||||
else { tb_price.Text = ""; }
|
||||
|
||||
string data = f1GridView.Rows[row].Cells["Column1"].Value.ToString();
|
||||
var data = (string[])f1GridView.Rows[row].Cells["Column1"].Value;
|
||||
inputGrid(data);
|
||||
}
|
||||
private void inputGrid(string data)
|
||||
private void inputGrid(string[] tmp)
|
||||
{
|
||||
dataGridView1.Rows.Clear();
|
||||
|
||||
// 도서명 / 저자 / 출판사 / isbn / 출간일 / 카테고리 / 품절여부
|
||||
string[] tmp = data.Split('|');
|
||||
//string[] tmp = data.Split('|');
|
||||
string[] grid = { "", "", "", "", "", "", "", "" };
|
||||
|
||||
for (int a = 0; a < tmp.Length; a++)
|
||||
@@ -186,8 +186,8 @@ namespace ISBN_Check_test
|
||||
string type = "Title";
|
||||
string query = tb_book_name.Text;
|
||||
|
||||
string aladin = api.Aladin(query, type, param);
|
||||
if (aladin == "") return;
|
||||
var aladin = api.Aladin(query, type, param);
|
||||
if (aladin.Any()==false) return;
|
||||
|
||||
inputGrid(aladin);
|
||||
}
|
||||
|
||||
@@ -65,32 +65,32 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||
<HintPath>packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Google.Protobuf, Version=3.14.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Google.Protobuf.3.14.0\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
<HintPath>..\packages\Google.Protobuf.3.14.0\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4, Version=1.1.11.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>packages\K4os.Compression.LZ4.1.1.11\lib\net46\K4os.Compression.LZ4.dll</HintPath>
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.1.1.11\lib\net46\K4os.Compression.LZ4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.1.11.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>packages\K4os.Compression.LZ4.Streams.1.1.11\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.1.11\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
|
||||
<HintPath>packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath>
|
||||
<HintPath>..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=8.0.25.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>packages\MySql.Data.8.0.25\lib\net452\MySql.Data.dll</HintPath>
|
||||
<HintPath>..\packages\MySql.Data.8.0.25\lib\net452\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Renci.SshNet, Version=2020.0.1.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106, processorArchitecture=MSIL">
|
||||
<HintPath>packages\SSH.NET.2020.0.1\lib\net40\Renci.SshNet.dll</HintPath>
|
||||
<HintPath>..\packages\SSH.NET.2020.0.1\lib\net40\Renci.SshNet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
@@ -99,14 +99,14 @@
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
|
||||
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
@@ -120,10 +120,10 @@
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>packages\MySql.Data.8.0.25\lib\net452\Ubiety.Dns.Core.dll</HintPath>
|
||||
<HintPath>..\packages\MySql.Data.8.0.25\lib\net452\Ubiety.Dns.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Zstandard.Net, Version=1.1.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>packages\MySql.Data.8.0.25\lib\net452\Zstandard.Net.dll</HintPath>
|
||||
<HintPath>..\packages\MySql.Data.8.0.25\lib\net452\Zstandard.Net.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
24
ISBN_Check/Main/Main.sln
Normal file
24
ISBN_Check/Main/Main.sln
Normal file
@@ -0,0 +1,24 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ISBN_Check_test", "ISBN_Check_test.csproj", "{B1FE7D47-6EFF-E4AE-FF42-BADB7C89CEEE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B1FE7D47-6EFF-E4AE-FF42-BADB7C89CEEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B1FE7D47-6EFF-E4AE-FF42-BADB7C89CEEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B1FE7D47-6EFF-E4AE-FF42-BADB7C89CEEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B1FE7D47-6EFF-E4AE-FF42-BADB7C89CEEE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {E8EB61EB-992B-4C29-AC57-A0B63137A787}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -31,6 +31,6 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
|
||||
// 기본값으로 할 수 있습니다.
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("25.10.29.2300")]
|
||||
// [assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("25.10.29.2300")]
|
||||
|
||||
@@ -12,6 +12,7 @@ using WindowsFormsApp1;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
||||
namespace ISBN_Check_test
|
||||
{
|
||||
public partial class Yes24 : Form
|
||||
@@ -55,16 +56,17 @@ namespace ISBN_Check_test
|
||||
int count = f1.dataGridView1.Rows.Count - 1;
|
||||
string price = "";
|
||||
|
||||
for (int a = 0; a < count; a++)
|
||||
foreach(DataGridViewRow drowview in f1.dataGridView1.Rows)
|
||||
{
|
||||
if (f1.dataGridView1.Rows[a].Cells["price"].Value != null)
|
||||
if (drowview.Cells["price"].Value != null)
|
||||
{
|
||||
price = f1.dataGridView1.Rows[a].Cells["price"].Value.ToString();
|
||||
price = drowview.Cells["price"].Value.ToString();
|
||||
}
|
||||
|
||||
var bookName = f1.dataGridView1.Rows[a].Cells["book_name"].Value?.ToString() ?? string.Empty;
|
||||
var author = f1.dataGridView1.Rows[a].Cells["author"].Value?.ToString() ?? string.Empty;
|
||||
var bookComp = f1.dataGridView1.Rows[a].Cells["book_comp"].Value?.ToString() ?? string.Empty;
|
||||
var bookName = drowview.Cells["book_name"].Value?.ToString() ?? string.Empty;
|
||||
var author = drowview.Cells["author"].Value?.ToString() ?? string.Empty;
|
||||
var bookComp = drowview.Cells["book_comp"].Value?.ToString() ?? string.Empty;
|
||||
if (string.IsNullOrEmpty(bookName) && string.IsNullOrEmpty(author) && string.IsNullOrEmpty(bookComp)) continue;
|
||||
|
||||
List<string> grid = new List<string>();
|
||||
grid.Add(bookName);
|
||||
@@ -73,7 +75,7 @@ namespace ISBN_Check_test
|
||||
grid.Add(Replace_target(author, "author"));
|
||||
grid.Add(bookComp);
|
||||
grid.Add(Replace_target(bookComp, "book_comp"));
|
||||
|
||||
grid.Add(price);
|
||||
dataGridView1.Rows.Add(grid.ToArray());
|
||||
|
||||
}
|
||||
@@ -124,15 +126,17 @@ namespace ISBN_Check_test
|
||||
private void btn_change_Click(object sender, EventArgs e)
|
||||
{
|
||||
string[,] grid = new string[dataGridView1.Rows.Count, 6];
|
||||
for (int a = 0; a < dataGridView1.Rows.Count; a++)
|
||||
var idx = 0;
|
||||
foreach (DataGridViewRow drv in dataGridView1.Rows)// int a = 0; a < dataGridView1.Rows.Count; a++)
|
||||
{
|
||||
string price = dataGridView1.Rows[a].Cells["price"].Value.ToString();
|
||||
int count = a + 1;
|
||||
grid[a, 0] = count.ToString();
|
||||
grid[a, 1] = dataGridView1.Rows[a].Cells["after_book_name"].Value.ToString();
|
||||
grid[a, 3] = dataGridView1.Rows[a].Cells["after_book_comp"].Value.ToString();
|
||||
grid[a, 4] = Regex.Replace(price, @"[^0-9]", "");
|
||||
grid[a, 5] = "1";
|
||||
string price = drv.Cells["price"].Value?.ToString() ?? string.Empty;
|
||||
int count = idx + 1;
|
||||
grid[idx, 0] = count.ToString();
|
||||
grid[idx, 1] = drv.Cells["after_book_name"].Value.ToString();
|
||||
grid[idx, 3] = drv.Cells["after_book_comp"].Value.ToString();
|
||||
grid[idx, 4] = Regex.Replace(price, @"[^0-9]", "");
|
||||
grid[idx, 5] = "1";
|
||||
idx += 1;
|
||||
}
|
||||
Excel_change(grid);
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
||||
280
ISBN_Client/ISBN_Client.Designer.cs
generated
280
ISBN_Client/ISBN_Client.Designer.cs
generated
@@ -1,280 +0,0 @@
|
||||
|
||||
namespace ISBN_Client
|
||||
{
|
||||
partial class Client
|
||||
{
|
||||
/// <summary>
|
||||
/// 필수 디자이너 변수입니다.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 사용 중인 모든 리소스를 정리합니다.
|
||||
/// </summary>
|
||||
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form 디자이너에서 생성한 코드
|
||||
|
||||
/// <summary>
|
||||
/// 디자이너 지원에 필요한 메서드입니다.
|
||||
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.rtb_Ip = new System.Windows.Forms.RichTextBox();
|
||||
this.lbl_cnt = new System.Windows.Forms.Label();
|
||||
this.lbl_filename = new System.Windows.Forms.Label();
|
||||
this.lbl_ClientVer = new System.Windows.Forms.Label();
|
||||
this.lbl_SerVer = new System.Windows.Forms.Label();
|
||||
this.lbl_Files = new System.Windows.Forms.Label();
|
||||
this.lbl_status = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.btn_Close = new System.Windows.Forms.Button();
|
||||
this.btn_ok = new System.Windows.Forms.Button();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.file_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.update_status = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel1.Controls.Add(this.rtb_Ip);
|
||||
this.panel1.Controls.Add(this.lbl_cnt);
|
||||
this.panel1.Controls.Add(this.lbl_filename);
|
||||
this.panel1.Controls.Add(this.lbl_ClientVer);
|
||||
this.panel1.Controls.Add(this.lbl_SerVer);
|
||||
this.panel1.Controls.Add(this.lbl_Files);
|
||||
this.panel1.Controls.Add(this.lbl_status);
|
||||
this.panel1.Controls.Add(this.label7);
|
||||
this.panel1.Controls.Add(this.progressBar1);
|
||||
this.panel1.Controls.Add(this.label3);
|
||||
this.panel1.Controls.Add(this.label2);
|
||||
this.panel1.Controls.Add(this.label1);
|
||||
this.panel1.Location = new System.Drawing.Point(12, 12);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(325, 268);
|
||||
this.panel1.TabIndex = 5;
|
||||
//
|
||||
// rtb_Ip
|
||||
//
|
||||
this.rtb_Ip.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.rtb_Ip.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.rtb_Ip.Location = new System.Drawing.Point(124, 102);
|
||||
this.rtb_Ip.Name = "rtb_Ip";
|
||||
this.rtb_Ip.ReadOnly = true;
|
||||
this.rtb_Ip.Size = new System.Drawing.Size(190, 61);
|
||||
this.rtb_Ip.TabIndex = 5;
|
||||
this.rtb_Ip.Text = "";
|
||||
//
|
||||
// lbl_cnt
|
||||
//
|
||||
this.lbl_cnt.AutoSize = true;
|
||||
this.lbl_cnt.Location = new System.Drawing.Point(265, 217);
|
||||
this.lbl_cnt.Name = "lbl_cnt";
|
||||
this.lbl_cnt.Size = new System.Drawing.Size(45, 12);
|
||||
this.lbl_cnt.TabIndex = 4;
|
||||
this.lbl_cnt.Text = "(10/10)";
|
||||
//
|
||||
// lbl_filename
|
||||
//
|
||||
this.lbl_filename.Location = new System.Drawing.Point(20, 217);
|
||||
this.lbl_filename.Name = "lbl_filename";
|
||||
this.lbl_filename.Size = new System.Drawing.Size(211, 12);
|
||||
this.lbl_filename.TabIndex = 3;
|
||||
//
|
||||
// lbl_ClientVer
|
||||
//
|
||||
this.lbl_ClientVer.AutoSize = true;
|
||||
this.lbl_ClientVer.Location = new System.Drawing.Point(124, 52);
|
||||
this.lbl_ClientVer.Name = "lbl_ClientVer";
|
||||
this.lbl_ClientVer.Size = new System.Drawing.Size(0, 12);
|
||||
this.lbl_ClientVer.TabIndex = 2;
|
||||
//
|
||||
// lbl_SerVer
|
||||
//
|
||||
this.lbl_SerVer.AutoSize = true;
|
||||
this.lbl_SerVer.Location = new System.Drawing.Point(124, 26);
|
||||
this.lbl_SerVer.Name = "lbl_SerVer";
|
||||
this.lbl_SerVer.Size = new System.Drawing.Size(0, 12);
|
||||
this.lbl_SerVer.TabIndex = 2;
|
||||
//
|
||||
// lbl_Files
|
||||
//
|
||||
this.lbl_Files.AutoSize = true;
|
||||
this.lbl_Files.Location = new System.Drawing.Point(124, 79);
|
||||
this.lbl_Files.Name = "lbl_Files";
|
||||
this.lbl_Files.Size = new System.Drawing.Size(0, 12);
|
||||
this.lbl_Files.TabIndex = 2;
|
||||
//
|
||||
// lbl_status
|
||||
//
|
||||
this.lbl_status.Font = new System.Drawing.Font("굴림", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.lbl_status.ForeColor = System.Drawing.Color.DeepPink;
|
||||
this.lbl_status.Location = new System.Drawing.Point(-3, 166);
|
||||
this.lbl_status.Name = "lbl_status";
|
||||
this.lbl_status.Size = new System.Drawing.Size(317, 29);
|
||||
this.lbl_status.TabIndex = 0;
|
||||
this.lbl_status.Text = "최신파일입니다 !!";
|
||||
this.lbl_status.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.label7.Location = new System.Drawing.Point(12, 52);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(106, 12);
|
||||
this.label7.TabIndex = 0;
|
||||
this.label7.Text = "클라이언트버전 :";
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
this.progressBar1.Location = new System.Drawing.Point(22, 232);
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Size = new System.Drawing.Size(288, 16);
|
||||
this.progressBar1.TabIndex = 1;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.label3.Location = new System.Drawing.Point(51, 26);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(67, 12);
|
||||
this.label3.TabIndex = 0;
|
||||
this.label3.Text = "서버버전 :";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.label2.Location = new System.Drawing.Point(2, 79);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(116, 12);
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "업데이트 파일 수 :";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.label1.Location = new System.Drawing.Point(51, 105);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(67, 12);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "설치경로 :";
|
||||
//
|
||||
// btn_Close
|
||||
//
|
||||
this.btn_Close.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.btn_Close.Location = new System.Drawing.Point(197, 294);
|
||||
this.btn_Close.Name = "btn_Close";
|
||||
this.btn_Close.Size = new System.Drawing.Size(123, 34);
|
||||
this.btn_Close.TabIndex = 3;
|
||||
this.btn_Close.Text = "취 소";
|
||||
this.btn_Close.UseVisualStyleBackColor = true;
|
||||
this.btn_Close.Click += new System.EventHandler(this.btn_Close_Click);
|
||||
//
|
||||
// btn_ok
|
||||
//
|
||||
this.btn_ok.Font = new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.btn_ok.Location = new System.Drawing.Point(30, 294);
|
||||
this.btn_ok.Name = "btn_ok";
|
||||
this.btn_ok.Size = new System.Drawing.Size(123, 34);
|
||||
this.btn_ok.TabIndex = 4;
|
||||
this.btn_ok.Text = "button1";
|
||||
this.btn_ok.UseVisualStyleBackColor = true;
|
||||
this.btn_ok.Click += new System.EventHandler(this.btn_ok_Click);
|
||||
//
|
||||
// dataGridView1
|
||||
//
|
||||
this.dataGridView1.AllowUserToAddRows = false;
|
||||
this.dataGridView1.AllowUserToDeleteRows = false;
|
||||
this.dataGridView1.AllowUserToResizeRows = false;
|
||||
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.file_name,
|
||||
this.update_status});
|
||||
this.dataGridView1.Location = new System.Drawing.Point(397, 12);
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.RowTemplate.Height = 23;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(399, 269);
|
||||
this.dataGridView1.TabIndex = 6;
|
||||
//
|
||||
// file_name
|
||||
//
|
||||
this.file_name.DataPropertyName = "file_name";
|
||||
this.file_name.HeaderText = "파일명";
|
||||
this.file_name.Name = "file_name";
|
||||
this.file_name.ReadOnly = true;
|
||||
this.file_name.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.file_name.Width = 200;
|
||||
//
|
||||
// update_status
|
||||
//
|
||||
this.update_status.DataPropertyName = "chk";
|
||||
this.update_status.FalseValue = "F";
|
||||
this.update_status.HeaderText = "업데이트완료";
|
||||
this.update_status.IndeterminateValue = "F";
|
||||
this.update_status.Name = "update_status";
|
||||
this.update_status.ReadOnly = true;
|
||||
this.update_status.TrueValue = "T";
|
||||
//
|
||||
// Client
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(351, 347);
|
||||
this.Controls.Add(this.dataGridView1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.btn_Close);
|
||||
this.Controls.Add(this.btn_ok);
|
||||
this.Name = "Client";
|
||||
this.Text = "ISBN 조회 자동 업데이트";
|
||||
this.Load += new System.EventHandler(this.Client_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.RichTextBox rtb_Ip;
|
||||
private System.Windows.Forms.Label lbl_cnt;
|
||||
private System.Windows.Forms.Label lbl_filename;
|
||||
private System.Windows.Forms.Label lbl_ClientVer;
|
||||
private System.Windows.Forms.Label lbl_SerVer;
|
||||
private System.Windows.Forms.Label lbl_Files;
|
||||
private System.Windows.Forms.Label lbl_status;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.ProgressBar progressBar1;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button btn_Close;
|
||||
private System.Windows.Forms.Button btn_ok;
|
||||
private System.Windows.Forms.DataGridView dataGridView1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn file_name;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn update_status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,240 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
// 추가된 참조
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace ISBN_Client
|
||||
{
|
||||
public partial class Client : Form
|
||||
{
|
||||
// FTP ID / PW
|
||||
private string Login_id = "ftpgloria";
|
||||
private string Login_pw = "admin@!@#$";
|
||||
|
||||
// 서버 / 클라이언트 버전
|
||||
private string Sr_Vers = "";
|
||||
private string Cl_Vers = "";
|
||||
|
||||
// 서버 아이피
|
||||
private string Server_Ip = "";
|
||||
|
||||
// 종료시 실행시킬 파일명
|
||||
private string Start_Prg = "";
|
||||
|
||||
// 파일 개수
|
||||
private int Files_Count = 0;
|
||||
|
||||
// 업데이트 진행 파일 수
|
||||
private int down_Count = 0;
|
||||
|
||||
// 업데이트 여부
|
||||
bool tf = false;
|
||||
|
||||
private string sLine = "";
|
||||
|
||||
private string[] str = new string[2];
|
||||
int i = -1;
|
||||
|
||||
DataSet ds = new DataSet("files");
|
||||
|
||||
public Client()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Client_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 파일 목록 생성을 위한 데이터 셋
|
||||
ds.Tables.Add("파일");
|
||||
|
||||
ds.Tables["파일"].Columns.Add("file_name");
|
||||
ds.Tables["파일"].Columns.Add("chk");
|
||||
|
||||
File_info();
|
||||
|
||||
dataGridView1.DataSource = ds.Tables["파일"];
|
||||
|
||||
// 서버의 update_isbn.inf 파일에서 버전 추출
|
||||
FtpWebRequest fwr = (FtpWebRequest)WebRequest.Create("ftp://" + Login_id + "@" + Server_Ip + "/ISBN/Update_isbn.inf");
|
||||
fwr.Credentials = new NetworkCredential(Login_id, Login_pw);
|
||||
|
||||
fwr.Method = WebRequestMethods.Ftp.DownloadFile;
|
||||
|
||||
FtpWebResponse fr = (FtpWebResponse)fwr.GetResponse();
|
||||
StreamReader sr = new StreamReader(fr.GetResponseStream());
|
||||
|
||||
while (!sr.EndOfStream)
|
||||
{
|
||||
sLine = sr.ReadLine();
|
||||
i = sLine.IndexOf("count=", 0);
|
||||
|
||||
// 서버 버전 추출
|
||||
if(sLine.IndexOf("count=", 0) != -1)
|
||||
{
|
||||
Sr_Vers = sLine.Replace("count=", "");
|
||||
lbl_SerVer.Text = Sr_Vers;
|
||||
break;
|
||||
}
|
||||
}
|
||||
sr.Close();
|
||||
|
||||
// 버전이 같은 경우 버튼 변경
|
||||
if (Convert.ToDecimal(Sr_Vers) == Convert.ToDecimal(Cl_Vers))
|
||||
{
|
||||
btn_ok.Text = "프로그램 실행";
|
||||
|
||||
lbl_status.Text = "최신 버전입니다!";
|
||||
lbl_status.ForeColor = Color.Blue;
|
||||
|
||||
lbl_filename.Text = "";
|
||||
lbl_cnt.Text = "";
|
||||
|
||||
for(int a = 0; a < dataGridView1.Rows.Count; a++)
|
||||
{
|
||||
dataGridView1.Rows[a].Cells["update_status"].Value = "T";
|
||||
}
|
||||
|
||||
btn_ok_Click(null, null);
|
||||
}
|
||||
else if (Convert.ToDecimal(Sr_Vers) > Convert.ToDecimal(Cl_Vers))
|
||||
{
|
||||
btn_ok.Text = "업데이트";
|
||||
tf = true;
|
||||
|
||||
lbl_cnt.Text = "(1/" + dataGridView1.Rows.Count.ToString() + ")";
|
||||
lbl_status.Text = "업데이트가 존재합니다!";
|
||||
lbl_status.ForeColor = Color.DeepPink;
|
||||
}
|
||||
}
|
||||
catch(System.Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void btn_ok_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (tf)
|
||||
{
|
||||
// 업데이트가 존재할 때
|
||||
download(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 업데이트가 없을 때
|
||||
string start_program = Application.StartupPath + "\\" + Start_Prg;
|
||||
Process prc = new Process();
|
||||
prc.StartInfo = new System.Diagnostics.ProcessStartInfo(start_program);
|
||||
prc.Start();
|
||||
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void download(int cnt)
|
||||
{
|
||||
if (cnt < Convert.ToInt32(lbl_Files.Text))
|
||||
{
|
||||
WebClient clnt = new WebClient();
|
||||
clnt.Credentials = new NetworkCredential(Login_id, Login_pw);
|
||||
|
||||
lbl_status.Text = "업데이트 진행중!";
|
||||
progressBar1.Value = (progressBar1.Maximum / Convert.ToInt32(lbl_Files.Text)) * (down_Count + 1);
|
||||
|
||||
lbl_filename.Text = dataGridView1.Rows[cnt].Cells["file_name"].Value.ToString();
|
||||
|
||||
dataGridView1.Rows[cnt].Cells["update_status"].Value = "T";
|
||||
lbl_cnt.Text = "(" + (cnt + 1).ToString() + "/" + (dataGridView1.Rows.Count).ToString() + ")";
|
||||
|
||||
File.Delete(Application.StartupPath + lbl_filename.Text);
|
||||
|
||||
clnt.DownloadFileAsync(new Uri("ftp://" + Login_id + "@" + Server_Ip + "/ISBN/" + lbl_filename.Text),
|
||||
Application.StartupPath + "\\" + lbl_filename.Text);
|
||||
|
||||
clnt.DownloadFileCompleted += new AsyncCompletedEventHandler(clnt_DownloadFileCompleted);
|
||||
}
|
||||
else
|
||||
{
|
||||
File_info();
|
||||
|
||||
progressBar1.Value = progressBar1.Maximum;
|
||||
btn_ok.Text = "프로그램 실행";
|
||||
|
||||
lbl_status.Text = "최신 파일입니다!";
|
||||
lbl_status.ForeColor = Color.Blue;
|
||||
|
||||
lbl_filename.Text = "";
|
||||
lbl_cnt.Text = "";
|
||||
tf = false;
|
||||
}
|
||||
}
|
||||
void clnt_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
|
||||
{
|
||||
down_Count += 1;
|
||||
download(down_Count);
|
||||
}
|
||||
|
||||
private void File_info()
|
||||
{
|
||||
// 클라이언트 파일 정보
|
||||
// update.inf 파일에서 파일개수, 파일명, 버전 추출
|
||||
StreamReader sr = new StreamReader(Application.StartupPath + "\\Update_isbn.inf");
|
||||
int i = -1;
|
||||
while(sr.EndOfStream != true)
|
||||
{
|
||||
sLine = sr.ReadLine();
|
||||
i = sLine.IndexOf("count=", 0);
|
||||
|
||||
// 버전 추출
|
||||
if (sLine.IndexOf("count=", 0) != -1)
|
||||
{
|
||||
Cl_Vers = sLine.Replace("count=", "");
|
||||
lbl_ClientVer.Text = Cl_Vers;
|
||||
}
|
||||
// 설치 경로 추출
|
||||
else if (sLine.IndexOf("server_url=", 0) != -1)
|
||||
{
|
||||
Server_Ip = sLine.Replace("server_url=", "");
|
||||
rtb_Ip.Text = Server_Ip;
|
||||
//rtb_Ip.Text = Application.StartupPath;
|
||||
}
|
||||
// 종료시 실행 파일
|
||||
else if (sLine.IndexOf("exe=", 0) != -1)
|
||||
{
|
||||
Start_Prg = sLine.Replace("exe=", "");
|
||||
}
|
||||
// 파일 개수 추출
|
||||
else if (sLine.IndexOf("Files=", 0) != -1)
|
||||
{
|
||||
Files_Count = Convert.ToInt32(sLine.Replace("Files=", ""));
|
||||
lbl_Files.Text = Files_Count.ToString();
|
||||
}
|
||||
else if(sLine.IndexOf("\\", 0) != -1)
|
||||
{
|
||||
str[0] = sLine.Replace("\\", "");
|
||||
str[1] = "F";
|
||||
ds.Tables["파일"].Rows.Add(str);
|
||||
}
|
||||
i = -1;
|
||||
}
|
||||
sr.Close();
|
||||
}
|
||||
|
||||
private void btn_Close_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{1A792D56-127B-446B-8B01-0A60902E0086}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>ISBN_Client</RootNamespace>
|
||||
<AssemblyName>ISBN_Client</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>false</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ISBN_Client.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ISBN_Client.Designer.cs">
|
||||
<DependentUpon>ISBN_Client.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="ISBN_Client.resx">
|
||||
<DependentUpon>ISBN_Client.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<None Include="Properties\app.manifest" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ISBN_Client
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 해당 애플리케이션의 주 진입점입니다.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Client());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
|
||||
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이러한 특성 값을 변경하세요.
|
||||
[assembly: AssemblyTitle("ISBN_Client")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft Corporation")]
|
||||
[assembly: AssemblyProduct("ISBN_Client")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft Corporation 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("1a792d56-127b-446b-8b01-0a60902e0086")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
|
||||
// 기본값으로 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
70
ISBN_Client/Properties/Resources.Designer.cs
generated
70
ISBN_Client/Properties/Resources.Designer.cs
generated
@@ -1,70 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 이 코드는 도구를 사용하여 생성되었습니다.
|
||||
// 런타임 버전:4.0.30319.42000
|
||||
//
|
||||
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
|
||||
// 이러한 변경 내용이 손실됩니다.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace ISBN_Client.Properties
|
||||
{
|
||||
/// <summary>
|
||||
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
|
||||
/// </summary>
|
||||
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
|
||||
// 클래스에서 자동으로 생성되었습니다.
|
||||
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여
|
||||
// ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ISBN_Client.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
|
||||
/// 재정의합니다.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
29
ISBN_Client/Properties/Settings.Designer.cs
generated
29
ISBN_Client/Properties/Settings.Designer.cs
generated
@@ -1,29 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace ISBN_Client.Properties
|
||||
{
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC 매니페스트 옵션
|
||||
Windows 사용자 계정 컨트롤 수준을 변경하려면
|
||||
requestedExecutionLevel 노드를 다음 중 하나로 바꿉니다.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
requestedExecutionLevel 요소를 지정하면 파일 및 레지스트리 가상화를 사용하지 않습니다.
|
||||
이전 버전과의 호환성을 위해 애플리케이션에 가상화가 필요한 경우
|
||||
이 요소를 제거합니다.
|
||||
-->
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
<PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
|
||||
</applicationRequestMinimum>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- 이 애플리케이션이 테스트되고 함께 작동하도록 설계된 Windows 버전
|
||||
목록입니다. 해당 요소의 주석 처리를 제거하면 Windows에서
|
||||
호환 가능성이 가장 큰 환경을 자동으로 선택합니다. -->
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- 애플리케이션이 DPI를 인식하며 높은 DPI에서 Windows가 자동으로 스케일링하지
|
||||
않음을 나타냅니다. WPF(Windows Presentation Foundation) 애플리케이션은 자동으로 DPI를 인식하며
|
||||
옵트인할 필요가 없습니다. 이 설정에 옵트인한 .NET Framework 4.6을 대상으로 하는
|
||||
Windows Forms 애플리케이션은 app.config에서 'EnableWindowsFormsHighDpiAutoResizing' 설정도 'true'로 설정해야 합니다.
|
||||
|
||||
애플리케이션이 긴 경로를 인식하도록 설정합니다. https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation을 참조하세요. -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
<!-- Windows 공용 컨트롤 및 대화 상자의 테마 사용(Windows XP 이상) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
</assembly>
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("pofalApi_tmp")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8e7df6f68d424e8b9f20e24f017b877849125171")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("pofalApi_tmp")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("pofalApi_tmp")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
c13c9c2f2e12bc007cbcab6ccdb94397f9d2465a
|
||||
1e22963f41eb10ec8b7d5cf0f11446afcd4c7c64669758c39d9d6d7a2dc5abbf
|
||||
|
||||
Binary file not shown.
@@ -18,7 +18,7 @@
|
||||
},
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(git add:*)"
|
||||
"Bash(git push:*)"
|
||||
],
|
||||
"deny": [],
|
||||
"ask": []
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"hooks": {
|
||||
"conversation-start": "새로운 대화를 시작할 때 항상 CLAUDE.md 파일을 자동으로 읽고 프로젝트 컨텍스트를 파악하세요",
|
||||
"user-prompt-submit": "작업을 시작하기 전에 항상 CLAUDE.md 파일을 읽고 참조하세요"
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@
|
||||
- **데이터베이스**: MySQL
|
||||
- **주요기능**: 마크 작성, 복본조사, DLS 연동, 도서 정보 관리
|
||||
|
||||
## 데이터베이스 정보
|
||||
- Server=1.215.250.130;Port=3306;Database=unimarc;uid=root;pwd=Admin21234;
|
||||
|
||||
## 코딩 컨벤션
|
||||
- 파일명: PascalCase (예: DLS_Copy.cs)
|
||||
- 클래스명: PascalCase
|
||||
|
||||
19
unimarc/NuGet.Config
Normal file
19
unimarc/NuGet.Config
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
<add key="grapecity" value="https://nuget.grapecity.com/nuget" />
|
||||
</packageSources>
|
||||
<packageSourceCredentials />
|
||||
<packageRestore>
|
||||
<add key="enabled" value="True" />
|
||||
<add key="automatic" value="True" />
|
||||
</packageRestore>
|
||||
<bindingRedirects>
|
||||
<add key="skip" value="False" />
|
||||
</bindingRedirects>
|
||||
<packageManagement>
|
||||
<add key="format" value="0" />
|
||||
<add key="disabled" value="False" />
|
||||
</packageManagement>
|
||||
</configuration>
|
||||
@@ -9,6 +9,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Factory_Client", "Factory_C
|
||||
EndProject
|
||||
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "UniMarcSetup", "UniMarcSetup\UniMarcSetup.vdproj", "{B0A88F76-DC68-44F9-90B4-CD94625CC1F4}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "솔루션 항목", "솔루션 항목", "{2A3A057F-5D22-31FD-628C-DF5EF75AEF1E}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
CLAUDE.md = CLAUDE.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
||||
170
unimarc/unimarc/Helper_LibraryDelaySettings.cs
Normal file
170
unimarc/unimarc/Helper_LibraryDelaySettings.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Text;
|
||||
|
||||
namespace UniMarc
|
||||
{
|
||||
/// <summary>
|
||||
/// 도서관별 지연시간 설정을 관리하는 클래스
|
||||
/// </summary>
|
||||
public class Helper_LibraryDelaySettings
|
||||
{
|
||||
private static readonly string SettingsFileName = "LibraryDelaySettings.xml";
|
||||
private static readonly string SettingsFilePath = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"UniMarc",
|
||||
SettingsFileName
|
||||
);
|
||||
|
||||
private Dictionary<string, int> _libraryDelaySettings;
|
||||
|
||||
public Helper_LibraryDelaySettings()
|
||||
{
|
||||
_libraryDelaySettings = new Dictionary<string, int>();
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 도서관별 지연시간 설정을 로드
|
||||
/// </summary>
|
||||
private void LoadSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(SettingsFilePath))
|
||||
{
|
||||
var xmlDoc = new XmlDocument();
|
||||
xmlDoc.Load(SettingsFilePath);
|
||||
|
||||
var libraryNodes = xmlDoc.SelectNodes("//LibraryDelaySettings/Library");
|
||||
if (libraryNodes != null)
|
||||
{
|
||||
foreach (XmlNode node in libraryNodes)
|
||||
{
|
||||
var name = node.Attributes?["Name"]?.Value;
|
||||
var delayStr = node.Attributes?["Delay"]?.Value;
|
||||
|
||||
if (!string.IsNullOrEmpty(name) && int.TryParse(delayStr, out int delay))
|
||||
{
|
||||
_libraryDelaySettings[name] = delay;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"도서관 지연시간 설정 로드 오류: {ex.Message}");
|
||||
_libraryDelaySettings = new Dictionary<string, int>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 도서관별 지연시간 설정을 저장
|
||||
/// </summary>
|
||||
private void SaveSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
// 디렉토리 생성
|
||||
var directory = Path.GetDirectoryName(SettingsFilePath);
|
||||
if (!Directory.Exists(directory))
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
}
|
||||
|
||||
// XML 파일로 저장
|
||||
var xmlDoc = new XmlDocument();
|
||||
var declaration = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null);
|
||||
xmlDoc.AppendChild(declaration);
|
||||
|
||||
var root = xmlDoc.CreateElement("LibraryDelaySettings");
|
||||
xmlDoc.AppendChild(root);
|
||||
|
||||
foreach (var kvp in _libraryDelaySettings)
|
||||
{
|
||||
var libraryElement = xmlDoc.CreateElement("Library");
|
||||
libraryElement.SetAttribute("Name", kvp.Key);
|
||||
libraryElement.SetAttribute("Delay", kvp.Value.ToString());
|
||||
root.AppendChild(libraryElement);
|
||||
}
|
||||
|
||||
xmlDoc.Save(SettingsFilePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"도서관 지연시간 설정 저장 오류: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 특정 도서관의 지연시간 설정을 가져옴
|
||||
/// </summary>
|
||||
/// <param name="libraryName">도서관 이름</param>
|
||||
/// <returns>지연시간(초), 설정이 없으면 0</returns>
|
||||
public int GetDelay(string libraryName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(libraryName))
|
||||
return 0;
|
||||
|
||||
return _libraryDelaySettings.TryGetValue(libraryName, out int delay) ? delay : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 특정 도서관의 지연시간 설정을 저장
|
||||
/// </summary>
|
||||
/// <param name="libraryName">도서관 이름</param>
|
||||
/// <param name="delaySeconds">지연시간(초)</param>
|
||||
public void SetDelay(string libraryName, int delaySeconds)
|
||||
{
|
||||
if (string.IsNullOrEmpty(libraryName))
|
||||
return;
|
||||
|
||||
if (delaySeconds < 0)
|
||||
delaySeconds = 0;
|
||||
|
||||
_libraryDelaySettings[libraryName] = delaySeconds;
|
||||
SaveSettings();
|
||||
|
||||
Console.WriteLine($"도서관 지연시간 설정 저장: {libraryName} = {delaySeconds}초");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 모든 도서관 지연시간 설정을 가져옴
|
||||
/// </summary>
|
||||
/// <returns>도서관명-지연시간 딕셔너리</returns>
|
||||
public Dictionary<string, int> GetAllSettings()
|
||||
{
|
||||
return new Dictionary<string, int>(_libraryDelaySettings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 특정 도서관의 지연시간 설정을 제거
|
||||
/// </summary>
|
||||
/// <param name="libraryName">도서관 이름</param>
|
||||
public void RemoveDelay(string libraryName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(libraryName))
|
||||
return;
|
||||
|
||||
if (_libraryDelaySettings.ContainsKey(libraryName))
|
||||
{
|
||||
_libraryDelaySettings.Remove(libraryName);
|
||||
SaveSettings();
|
||||
Console.WriteLine($"도서관 지연시간 설정 제거: {libraryName}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 모든 지연시간 설정을 초기화
|
||||
/// </summary>
|
||||
public void ClearAllSettings()
|
||||
{
|
||||
_libraryDelaySettings.Clear();
|
||||
SaveSettings();
|
||||
Console.WriteLine("모든 도서관 지연시간 설정 초기화");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1531,7 +1531,7 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
master_batch_Processing = new Batch_processing(this);
|
||||
master_batch_Processing.MdiParent = this;
|
||||
master_batch_Processing.WindowState = FormWindowState.Maximized;
|
||||
//master_batch_Processing.WindowState = FormWindowState.Maximized;
|
||||
master_batch_Processing.FormClosed += (o, ea) => master_batch_Processing = null;
|
||||
master_batch_Processing.Show();
|
||||
}
|
||||
|
||||
@@ -30,14 +30,9 @@ namespace WindowsFormsApp1
|
||||
Application.Run(new Main());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void DB_InitSetting()
|
||||
{
|
||||
UniMarc.Properties.Settings.Default.IP = ConvertIP(UniMarc.Properties.Settings.Default.IP);
|
||||
UniMarc.Properties.Settings.Default.IP = ConvertIP(UniMarc.Properties.Settings.Default.IP);
|
||||
UniMarc.Properties.Settings.Default.Port = Convert2to10(UniMarc.Properties.Settings.Default.Port);
|
||||
UniMarc.Properties.Settings.Default.Uid = ConvertAscii(UniMarc.Properties.Settings.Default.Uid);
|
||||
UniMarc.Properties.Settings.Default.pwd = ConvertAscii(UniMarc.Properties.Settings.Default.pwd);
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
|
||||
// 기본값으로 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("2025.08.14.1630")]
|
||||
[assembly: AssemblyFileVersion("2025.08.14.1630")]
|
||||
[assembly: AssemblyVersion("2025.10.11.1430")]
|
||||
[assembly: AssemblyFileVersion("2025.10.11.1430")]
|
||||
|
||||
@@ -397,8 +397,10 @@ namespace BokBonCheck
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg);
|
||||
// SearchAsync에서 PageSource 가져오기
|
||||
var htmlContent = _driver.PageSource;
|
||||
var resultCount = ExtractBookCount(htmlContent, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -423,128 +425,40 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
|
||||
if (driver.Url.EndsWith("DetailSearchResult") == false)
|
||||
{
|
||||
errmessage = "결과페이지가아님";
|
||||
return -1;
|
||||
}
|
||||
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 1. 검색결과가 없는 경우 확인
|
||||
try
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
var noResultPatterns = new[]
|
||||
{
|
||||
var noResultElements = driver.FindElements(By.XPath("//*[contains(text(), '검색결과가 없습니다') or contains(text(), '검색된 자료가 없습니다')]"));
|
||||
if (noResultElements.Count > 0)
|
||||
@"검색결과가 없습니다",
|
||||
@"검색된 자료가 없습니다",
|
||||
@"자료가 없습니다",
|
||||
@"총 0 건",
|
||||
@"총 0건"
|
||||
};
|
||||
|
||||
foreach (var pattern in noResultPatterns)
|
||||
{
|
||||
if (htmlContent.Contains(pattern))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 검색결과가 있는 경우로 진행
|
||||
}
|
||||
|
||||
|
||||
RetryPoint:
|
||||
bool retry = false;
|
||||
// 2. 안산시 도서관 특화: span.count.gothic em 요소에서 직접 추출
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
var countElement = driver.FindElement(By.CssSelector("span.count.gothic em"));
|
||||
if (countElement != null)
|
||||
{
|
||||
// Text 대신 InnerHtml이나 GetAttribute 사용해보기
|
||||
var countText = countElement.Text.Trim();
|
||||
var innerHTML = countElement.GetAttribute("innerHTML");
|
||||
var outerHTML = countElement.GetAttribute("outerHTML");
|
||||
|
||||
Console.WriteLine($"count 요소 .Text: '{countText}'");
|
||||
Console.WriteLine($"count 요소 innerHTML: '{innerHTML}'");
|
||||
Console.WriteLine($"count 요소 outerHTML: '{outerHTML}'");
|
||||
|
||||
// innerHTML이나 outerHTML에서 텍스트 추출 시도
|
||||
string textToUse = !string.IsNullOrEmpty(countText) ? countText : innerHTML;
|
||||
if (string.IsNullOrEmpty(textToUse))
|
||||
var match = System.Text.RegularExpressions.Regex.Match(htmlContent, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
textToUse = outerHTML;
|
||||
}
|
||||
|
||||
Console.WriteLine($"추출할 텍스트: '{textToUse}'");
|
||||
|
||||
// "총 0 건 " 형태에서 숫자 추출
|
||||
var match = Regex.Match(textToUse, @"총\s*(\d+)\s*건", RegexOptions.IgnoreCase);
|
||||
if (match.Success && int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
Console.WriteLine("검색 결과: 0건");
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"검색 결과: {count}건");
|
||||
return count;
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"정규식 매칭 실패: '{textToUse}'");
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
Console.WriteLine($"span.count.gothic em 요소 추출 실패: {ex1.Message}");
|
||||
}
|
||||
|
||||
// 3. span.count 전체에서 추출 시도
|
||||
try
|
||||
{
|
||||
var countSpan = driver.FindElement(By.CssSelector("span.count"));
|
||||
if (countSpan != null)
|
||||
{
|
||||
var fullText = countSpan.Text.Trim();
|
||||
Console.WriteLine($"count span 전체 텍스트: '{fullText}'");
|
||||
|
||||
var match = Regex.Match(fullText, @"총\s*(\d+)\s*건", RegexOptions.IgnoreCase);
|
||||
if (match.Success && int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
Console.WriteLine($"span.count 요소 추출 실패: {ex2.Message}");
|
||||
}
|
||||
|
||||
// 3. 페이지 소스에서 정규식으로 추출 시도
|
||||
var pageSource = driver.PageSource;
|
||||
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
if (pageSource.Contains("검색결과가 없습니다") ||
|
||||
pageSource.Contains("검색된 자료가 없습니다") ||
|
||||
pageSource.Contains("자료가 없습니다") ||
|
||||
pageSource.Contains("총 0 건") ||
|
||||
pageSource.Contains("총 0건"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
// HTML에서 다양한 패턴 찾기 (안산시 도서관 특화)
|
||||
var htmlPatterns = new[]
|
||||
@@ -560,11 +474,14 @@ namespace BokBonCheck
|
||||
|
||||
foreach (var pattern in htmlPatterns)
|
||||
{
|
||||
var match = Regex.Match(pageSource, pattern, RegexOptions.IgnoreCase);
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
// 매칭된 부분과 상위 태그 추출하여 resulthtml에 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
@@ -576,28 +493,81 @@ namespace BokBonCheck
|
||||
}
|
||||
}
|
||||
|
||||
if (retry == false)
|
||||
{
|
||||
Console.WriteLine( "결과를 찾을 수 없어 재시도");
|
||||
retry = true;
|
||||
Task.Delay(1000);
|
||||
goto RetryPoint;
|
||||
}
|
||||
else
|
||||
{
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
return -1;
|
||||
}
|
||||
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
return -1;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
public async Task WaitForPageChange(WebDriverWait wait)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace BokBonCheck
|
||||
public DateTime SearchTime { get; set; }
|
||||
public string ErrorMessage { get; set; }
|
||||
public bool IsSuccess { get; set; }
|
||||
|
||||
public string Resulthtml { get; set; }
|
||||
}
|
||||
|
||||
public class BookSearchService
|
||||
|
||||
@@ -244,8 +244,9 @@ namespace BokBonCheck
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg);
|
||||
var htmlContent = _driver.PageSource;
|
||||
var resultCount = ExtractBookCount(htmlContent, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -270,73 +271,39 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 1. totalCount 요소에서 직접 추출 시도
|
||||
try
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
var noResultPatterns = new[]
|
||||
{
|
||||
var totalCountElement = driver.FindElement(By.CssSelector("p.totalCount"));
|
||||
if (totalCountElement != null)
|
||||
{
|
||||
// strong 태그에서 직접 숫자 추출 시도
|
||||
try
|
||||
{
|
||||
var strongElement = totalCountElement.FindElement(By.TagName("strong"));
|
||||
if (strongElement != null)
|
||||
{
|
||||
var countText = strongElement.Text.Trim();
|
||||
if (int.TryParse(countText, out int strongCount))
|
||||
{
|
||||
if (strongCount == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({strongCount}권)";
|
||||
return strongCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
@"검색결과가 없습니다",
|
||||
@"검색된 자료가 없습니다",
|
||||
@"자료가 없습니다",
|
||||
@"전체 0 건"
|
||||
};
|
||||
|
||||
// 전체 텍스트에서 정규식으로 추출
|
||||
var totalCountText = totalCountElement.Text;
|
||||
var match = Regex.Match(totalCountText, @"전체\s*(\d+)\s*건", RegexOptions.IgnoreCase);
|
||||
foreach (var pattern in noResultPatterns)
|
||||
{
|
||||
if (htmlContent.Contains(pattern))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
var match = System.Text.RegularExpressions.Regex.Match(htmlContent, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
}
|
||||
else
|
||||
{
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"totalCount 요소 검색 중 오류: {ex.Message}");
|
||||
}
|
||||
|
||||
// 2. 페이지 소스에서 정규식으로 추출 시도
|
||||
var pageSource = driver.PageSource;
|
||||
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
if (pageSource.Contains("검색결과가 없습니다") ||
|
||||
pageSource.Contains("검색된 자료가 없습니다") ||
|
||||
pageSource.Contains("자료가 없습니다") ||
|
||||
pageSource.Contains("전체 0 건"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
// HTML에서 다양한 패턴 찾기
|
||||
var htmlPatterns = new[]
|
||||
@@ -350,11 +317,14 @@ namespace BokBonCheck
|
||||
|
||||
foreach (var pattern in htmlPatterns)
|
||||
{
|
||||
var match = Regex.Match(pageSource, pattern, RegexOptions.IgnoreCase);
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
// 매칭된 부분과 상위 태그 추출하여 resulthtml에 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
@@ -367,16 +337,80 @@ namespace BokBonCheck
|
||||
}
|
||||
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
return -1;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
public async Task WaitForPageChange(WebDriverWait wait)
|
||||
{
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace BokBonCheck
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
//request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@@ -84,7 +84,8 @@ namespace BokBonCheck
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage);
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
@@ -112,19 +113,21 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage, out string resulthtml)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 1. 검색 결과가 없는 경우 확인
|
||||
if (htmlContent.Contains("검색결과가 없습니다") ||
|
||||
htmlContent.Contains("검색된 자료가 없습니다") ||
|
||||
htmlContent.Contains("자료가 없습니다") ||
|
||||
htmlContent.Contains("자룼가 없습니다") ||
|
||||
htmlContent.Contains("<strong>0</strong> Results:"))
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -147,8 +150,11 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"조선이공대학교도서관 검색 결과: {count}건");
|
||||
return count;
|
||||
@@ -173,22 +179,27 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"조선이공대학교도서관 검색 결과: {count}건");
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 패턴을 찾지 못한 경우
|
||||
errorMessage = "검색결과 패턴을 찾을 수 없음";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
Console.WriteLine("조선이공대학교도서관 검색결과 패턴을 찾을 수 없음");
|
||||
return -1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = $"결과 분석 오류: {ex.Message}";
|
||||
resulthtml = "결과 분석 오류: " + ex.Message;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -197,5 +208,67 @@ namespace BokBonCheck
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ namespace BokBonCheck
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
//request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@@ -84,7 +84,8 @@ namespace BokBonCheck
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage);
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
@@ -112,9 +113,10 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage, out string resulthtml)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -125,6 +127,7 @@ namespace BokBonCheck
|
||||
htmlContent.Contains("총 <strong>0</strong>건"))
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -147,8 +150,11 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"조선대학교중앙도서관 검색 결과: {count}건");
|
||||
return count;
|
||||
@@ -173,22 +179,28 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"조선대학교중앙도서관 검색 결과: {count}건");
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 패턴을 찾지 못한 경우
|
||||
errorMessage = "검색결과 패턴을 찾을 수 없음";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
Console.WriteLine("조선대학교중앙도서관 검색결과 패턴을 찾을 수 없음");
|
||||
return -1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = $"결과 분석 오류: {ex.Message}";
|
||||
resulthtml = "결과 분석 오류: " + ex.Message;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -197,5 +209,67 @@ namespace BokBonCheck
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ using UniMarc.마크;
|
||||
using OpenQA.Selenium.Chromium;
|
||||
using UniMarc.SearchModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using AR;
|
||||
|
||||
namespace BokBonCheck
|
||||
{
|
||||
@@ -169,6 +170,11 @@ namespace BokBonCheck
|
||||
if (_driver.Url.EndsWith("/bookMain") == false)
|
||||
{
|
||||
retrycnt += 1;
|
||||
if (retrycnt > 3)
|
||||
{
|
||||
UTIL.MsgE("3회 연속 로그인 시도로 인해 자동 로그인을 중단합니다\n사용자가 직접 로그인을 하세요");
|
||||
break;
|
||||
}
|
||||
Console.WriteLine($"도서검색화면으로 이동({retrycnt})");
|
||||
_driver.Navigate().GoToUrl(this.SiteUrl);
|
||||
wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(15));
|
||||
@@ -190,6 +196,8 @@ namespace BokBonCheck
|
||||
this.SCHOOL = schoolname;
|
||||
this.STYPE = searchtype;
|
||||
}
|
||||
|
||||
string BookMainURL = string.Empty;
|
||||
public async Task<BookSearchResult> SearchAsync(string searchTerm)
|
||||
{
|
||||
var result = new BookSearchResult
|
||||
@@ -247,6 +255,19 @@ namespace BokBonCheck
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(BookMainURL))
|
||||
{
|
||||
BookMainURL = _driver.Url;
|
||||
}
|
||||
else
|
||||
{
|
||||
//확실하게 하기위해 메인페이지로 다시 이동한다.
|
||||
_driver.Navigate().GoToUrl(this.SiteUrl);
|
||||
new WebDriverWait(_driver, TimeSpan.FromSeconds(15));
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
|
||||
// 페이지 로딩 대기
|
||||
var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(15));
|
||||
|
||||
@@ -378,23 +399,24 @@ namespace BokBonCheck
|
||||
{
|
||||
SafeClick(buttomelm);
|
||||
var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(15));
|
||||
Thread.Sleep(200);
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
errmessage = "검색결과없음";
|
||||
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -422,7 +444,7 @@ namespace BokBonCheck
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
367
unimarc/unimarc/SearchModel/GochangLibSearcher.cs
Normal file
367
unimarc/unimarc/SearchModel/GochangLibSearcher.cs
Normal file
@@ -0,0 +1,367 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using OpenQA.Selenium.Support.UI;
|
||||
using System.Text.RegularExpressions;
|
||||
using WebDriverManager;
|
||||
using WebDriverManager.DriverConfigs.Impl;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using UniMarc.마크;
|
||||
using OpenQA.Selenium.Chromium;
|
||||
using UniMarc.SearchModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using AR;
|
||||
|
||||
namespace BokBonCheck
|
||||
{
|
||||
public class GochangLibSearcher : ILibrarySearcher
|
||||
{
|
||||
public string AreaCode { get; set; } = string.Empty;
|
||||
public string SiteName { get; protected set; }
|
||||
public string SiteUrl => "https://libsearch.gochang.go.kr:8443/book/bookAdvancedSearch";
|
||||
public bool HttpApiMode { get; set; } = false;
|
||||
|
||||
public int No { get; set; }
|
||||
|
||||
private ChromiumDriver _driver;
|
||||
|
||||
public GochangLibSearcher(int no, string areaCode, string areaName)
|
||||
{
|
||||
this.No = no;
|
||||
this.AreaCode = areaCode;
|
||||
this.SiteName = $"고창군립({areaName})";
|
||||
}
|
||||
|
||||
public void StopDriver()
|
||||
{
|
||||
if (_driver != null)
|
||||
{
|
||||
_driver.Quit();
|
||||
_driver.Dispose();
|
||||
_driver = null;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task StartDriver(bool showdriver = false)
|
||||
{
|
||||
if (_driver == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (SeleniumHelper.IsReady == false) await SeleniumHelper.Download();
|
||||
_driver = await SeleniumHelper.CreateDriver(ShowBrowser: showdriver);
|
||||
Console.WriteLine("GochangLibSearcher Driver 초기화 완료");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"GochangLibSearcher Driver 초기화 실패: {ex.Message}");
|
||||
throw new InvalidOperationException($"GochangLibSearcher Driver 초기화에 실패했습니다: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual protected bool SelectLibrary(WebDriverWait wait)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(AreaCode))
|
||||
{
|
||||
var libSelect = wait.Until(d => d.FindElement(By.Id("MANAGE_CODE")));
|
||||
var selectElement = new SelectElement(libSelect);
|
||||
selectElement.SelectByValue(AreaCode);
|
||||
Thread.Sleep(300);
|
||||
Console.WriteLine($"{AreaCode} 도서관으로 선택됨");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("전체 도서관으로 검색");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"도서관 선택 실패: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<BookSearchResult> SearchAsync(string searchTerm)
|
||||
{
|
||||
var result = new BookSearchResult
|
||||
{
|
||||
SiteName = SiteName,
|
||||
SearchTerm = searchTerm,
|
||||
SearchTime = DateTime.Now
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
if (_driver == null)
|
||||
{
|
||||
await StartDriver();
|
||||
}
|
||||
|
||||
var cururl = _driver.Url;
|
||||
if (cururl.Equals(SiteUrl) == false)
|
||||
_driver.Navigate().GoToUrl(SiteUrl);
|
||||
|
||||
var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(15));
|
||||
|
||||
if (SelectLibrary(wait) == false)
|
||||
{
|
||||
result.ErrorMessage = "도서관선택실패";
|
||||
result.BookCount = -1;
|
||||
result.IsSuccess = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var titleInput = wait.Until(d => d.FindElement(By.Id("title")));
|
||||
titleInput.Clear();
|
||||
titleInput.SendKeys(searchTerm);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.ErrorMessage = $"검색어입력실패({ex.Message})";
|
||||
result.BookCount = -1;
|
||||
result.IsSuccess = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var jsExecutor = (IJavaScriptExecutor)_driver;
|
||||
jsExecutor.ExecuteScript("fn_openBookAdvancedSearch();");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.ErrorMessage = $"검색실행실패({ex.Message})";
|
||||
result.BookCount = -1;
|
||||
result.IsSuccess = false;
|
||||
return result;
|
||||
}
|
||||
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
// SearchAsync에서 PageSource 가져오기
|
||||
var htmlContent = _driver.PageSource;
|
||||
var resultCount = ExtractBookCount(htmlContent, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
result.IsSuccess = false;
|
||||
result.ErrorMessage = ermsg;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.BookCount = resultCount;
|
||||
result.IsSuccess = true;
|
||||
result.ErrorMessage = ermsg;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsSuccess = false;
|
||||
result.ErrorMessage = ex.Message;
|
||||
result.BookCount = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
var noResultPatterns = new[]
|
||||
{
|
||||
@"검색된 도서가 없습니다",
|
||||
@"검색결과가 없습니다",
|
||||
@"검색된 자료가 없습니다"
|
||||
};
|
||||
|
||||
foreach (var pattern in noResultPatterns)
|
||||
{
|
||||
if (htmlContent.Contains(pattern))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
// 검색결과 없음 메시지를 포함한 HTML 조각 추출
|
||||
var index = htmlContent.IndexOf(pattern);
|
||||
if (index >= 0)
|
||||
{
|
||||
var startIndex = Math.Max(0, index - 100);
|
||||
var endIndex = Math.Min(htmlContent.Length, index + pattern.Length + 100);
|
||||
resulthtml = htmlContent.Substring(startIndex, endIndex - startIndex);
|
||||
|
||||
// 상위 태그 찾기 시도
|
||||
try
|
||||
{
|
||||
var match = System.Text.RegularExpressions.Regex.Match(htmlContent, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 실패시 기본 추출 결과 사용
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resulthtml = pattern;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
var htmlPatterns = new[]
|
||||
{
|
||||
@"<span[^>]*class=""bluecolor""[^>]*>총\s*(\d+)건</span>",
|
||||
@"총\s*<span[^>]*class=""bluecolor""[^>]*>(\d+)</span>건",
|
||||
@"총\s*(\d+)건"
|
||||
};
|
||||
|
||||
foreach (var pattern in htmlPatterns)
|
||||
{
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
// 매칭된 부분과 상위 태그 추출하여 resulthtml에 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
resulthtml = "결과수량을찾을수없음";
|
||||
return -1;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = "ExtractBookCount 오류: " + ex.Message;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
public async Task WaitForPageChange(WebDriverWait wait)
|
||||
{
|
||||
try
|
||||
{
|
||||
await Task.Delay(500);
|
||||
|
||||
wait.Until(d =>
|
||||
{
|
||||
var readyState = ((IJavaScriptExecutor)d).ExecuteScript("return document.readyState");
|
||||
return readyState.Equals("complete");
|
||||
});
|
||||
|
||||
wait.Until(d =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var pageSource = d.PageSource;
|
||||
return pageSource.Contains("검색결과입니다") ||
|
||||
pageSource.Contains("총") ||
|
||||
pageSource.Contains("건") ||
|
||||
pageSource.Contains("검색된 도서가 없습니다");
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Task.Delay(3000);
|
||||
Console.WriteLine($"페이지 변경 감지 실패: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -218,8 +218,9 @@ namespace BokBonCheck
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg);
|
||||
var htmlContent = _driver.PageSource;
|
||||
var resultCount = ExtractBookCount(htmlContent, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -244,67 +245,21 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 1. 먼저 totalCount 요소에서 직접 추출 시도
|
||||
try
|
||||
{
|
||||
var totalCountElement = driver.FindElement(By.CssSelector("p.totalCount"));
|
||||
if (totalCountElement != null)
|
||||
{
|
||||
var totalCountText = totalCountElement.Text; // 예: "전체 1 건"
|
||||
var match = Regex.Match(totalCountText, @"전체\s+(\d+)\s+건", RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
// strong 태그에서 직접 숫자 추출 시도
|
||||
try
|
||||
{
|
||||
var strongElement = totalCountElement.FindElement(By.TagName("strong"));
|
||||
if (strongElement != null && int.TryParse(strongElement.Text, out int strongCount))
|
||||
{
|
||||
if(strongCount == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
errmessage = $"검색성공({strongCount}권)";
|
||||
return strongCount;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"totalCount 요소 검색 중 오류: {ex.Message}");
|
||||
}
|
||||
|
||||
// 2. 페이지 소스에서 정규식으로 추출 시도
|
||||
var pageSource = driver.PageSource;
|
||||
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
if (pageSource.Contains("검색결과가 없습니다") ||
|
||||
pageSource.Contains("검색된 자료가 없습니다") ||
|
||||
pageSource.Contains("자료가 없습니다") ||
|
||||
pageSource.Contains("전체 0 건"))
|
||||
if (htmlContent.Contains("검색결과가 없습니다") ||
|
||||
htmlContent.Contains("검색된 자료가 없습니다") ||
|
||||
htmlContent.Contains("자료가 없습니다") ||
|
||||
htmlContent.Contains("전체 0 건"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = "검색결과가 없습니다";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -319,11 +274,14 @@ namespace BokBonCheck
|
||||
|
||||
foreach (var pattern in htmlPatterns)
|
||||
{
|
||||
var match = Regex.Match(pageSource, pattern, RegexOptions.IgnoreCase);
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
// 매칭된 부분과 상위 태그 추출하여 resulthtml에 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
@@ -335,49 +293,81 @@ namespace BokBonCheck
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 결과 테이블이나 리스트가 있는지 확인
|
||||
try
|
||||
{
|
||||
var resultElements = driver.FindElements(By.CssSelector(".bookList, .searchResult, .result-list, table tbody tr"));
|
||||
if (resultElements.Count > 0)
|
||||
{
|
||||
// 테이블 헤더나 빈 행을 제외한 실제 결과 개수 계산
|
||||
var actualCount = 0;
|
||||
foreach (var element in resultElements)
|
||||
{
|
||||
var text = element.Text?.Trim();
|
||||
if (!string.IsNullOrEmpty(text) &&
|
||||
!text.Contains("도서명") &&
|
||||
!text.Contains("저자") &&
|
||||
!text.Contains("출판사"))
|
||||
{
|
||||
actualCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (actualCount > 0)
|
||||
{
|
||||
errmessage = $"검색성공({actualCount}권)";
|
||||
return actualCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"결과 요소 검색 중 오류: {ex.Message}");
|
||||
}
|
||||
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
public async Task WaitForPageChange(WebDriverWait wait)
|
||||
{
|
||||
|
||||
@@ -155,8 +155,9 @@ namespace BokBonCheck
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg);
|
||||
var htmlContent = _driver.PageSource;
|
||||
var resultCount = ExtractBookCount(htmlContent, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -181,87 +182,38 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 1. 검색결과가 없는 경우 확인
|
||||
try
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
var noResultPatterns = new[]
|
||||
{
|
||||
var noResultElement = driver.FindElement(By.XPath("//p[contains(text(), '조회된 도서가 없습니다')]"));
|
||||
if (noResultElement != null)
|
||||
@"조회된 도서가 없습니다",
|
||||
@"검색결과가 없습니다",
|
||||
@"검색된 자료가 없습니다"
|
||||
};
|
||||
|
||||
foreach (var pattern in noResultPatterns)
|
||||
{
|
||||
if (htmlContent.Contains(pattern))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 검색결과가 있는 경우로 진행
|
||||
}
|
||||
|
||||
// 2. srch_info div에서 직접 추출 시도
|
||||
try
|
||||
{
|
||||
var srchInfoElement = driver.FindElement(By.CssSelector("div.srch_info"));
|
||||
if (srchInfoElement != null)
|
||||
{
|
||||
// span.heighlight에서 숫자 추출 시도
|
||||
try
|
||||
{
|
||||
var highlightElement = srchInfoElement.FindElement(By.CssSelector("span.heighlight"));
|
||||
if (highlightElement != null)
|
||||
{
|
||||
var countText = highlightElement.Text.Trim();
|
||||
if (int.TryParse(countText, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
// 전체 텍스트에서 정규식으로 추출
|
||||
var srchInfoText = srchInfoElement.Text;
|
||||
var match = Regex.Match(srchInfoText, @"검색결과\s*총\s*(\d+)\s*건", RegexOptions.IgnoreCase);
|
||||
var match = System.Text.RegularExpressions.Regex.Match(htmlContent, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
}
|
||||
else
|
||||
{
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"srch_info 요소 검색 중 오류: {ex.Message}");
|
||||
}
|
||||
|
||||
// 3. 페이지 소스에서 정규식으로 추출 시도
|
||||
var pageSource = driver.PageSource;
|
||||
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
if (pageSource.Contains("조회된 도서가 없습니다") ||
|
||||
pageSource.Contains("검색결과가 없습니다") ||
|
||||
pageSource.Contains("검색된 자료가 없습니다"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
// HTML에서 다양한 패턴 찾기
|
||||
var htmlPatterns = new[]
|
||||
@@ -274,11 +226,14 @@ namespace BokBonCheck
|
||||
|
||||
foreach (var pattern in htmlPatterns)
|
||||
{
|
||||
var match = Regex.Match(pageSource, pattern, RegexOptions.IgnoreCase);
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
// 매칭된 부분과 상위 태그 추출하여 resulthtml에 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
@@ -291,16 +246,80 @@ namespace BokBonCheck
|
||||
}
|
||||
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
return -1;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
public async Task WaitForPageChange(WebDriverWait wait)
|
||||
{
|
||||
|
||||
@@ -81,10 +81,11 @@ namespace BokBonCheck
|
||||
// HTTP GET 요청 실행 (추가 헤더 포함)
|
||||
using (var request = new HttpRequestMessage(HttpMethod.Get, searchUrl))
|
||||
{
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
// 브라우저와 유사한 헤더 추가 (인코딩 문제 방지를 위해 압축 해제)
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.9,en;q=0.1");
|
||||
request.Headers.Add("Accept-Charset", "UTF-8,*;q=0.1");
|
||||
// Accept-Encoding 제거 - 압축으로 인한 인코딩 문제 방지
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@@ -96,10 +97,50 @@ namespace BokBonCheck
|
||||
throw new HttpRequestException($"HTTP {(int)response.StatusCode} {response.StatusCode}: {errorContent}");
|
||||
}
|
||||
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
// 인코딩 문제 해결: 서버 응답의 Content-Type 확인 후 적절한 인코딩 사용
|
||||
string htmlContent;
|
||||
var contentType = response.Content.Headers.ContentType?.ToString() ?? "";
|
||||
Console.WriteLine($"광주동구 Content-Type: {contentType}");
|
||||
|
||||
if (contentType.Contains("charset="))
|
||||
{
|
||||
// 서버에서 지정한 charset 사용
|
||||
htmlContent = await response.Content.ReadAsStringAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
// charset이 명시되지 않은 경우 수동 처리
|
||||
var responseBytes = await response.Content.ReadAsByteArrayAsync();
|
||||
|
||||
// UTF-8 먼저 시도
|
||||
htmlContent = Encoding.UTF8.GetString(responseBytes);
|
||||
|
||||
// 한글이 없거나 깨진 경우 EUC-KR 시도
|
||||
if (!ContainsKorean(htmlContent) || htmlContent.Contains("<22>"))
|
||||
{
|
||||
try
|
||||
{
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
var euckrEncoding = Encoding.GetEncoding("EUC-KR");
|
||||
var euckrContent = euckrEncoding.GetString(responseBytes);
|
||||
if (ContainsKorean(euckrContent))
|
||||
{
|
||||
htmlContent = euckrContent;
|
||||
Console.WriteLine("광주동구: EUC-KR 인코딩 사용");
|
||||
}
|
||||
}
|
||||
catch (Exception encEx)
|
||||
{
|
||||
Console.WriteLine($"광주동구 EUC-KR 변환 오류: {encEx.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage);
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
|
||||
// ResultHtml에 분석용 HTML 저장 (디버깅용으로 일부만)
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
@@ -126,10 +167,11 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage,out string resulthtml)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
|
||||
resulthtml=string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 1. 검색 결과가 없는 경우 확인
|
||||
@@ -141,18 +183,23 @@ namespace BokBonCheck
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 2. 검색 결과 수량 추출: <p class="totalCount">전체 <strong>2</strong> 건</p>
|
||||
// 2. 검색 결과 수량 추출 - 더 포괄적인 패턴 사용
|
||||
var patterns = new[]
|
||||
{
|
||||
@"<p[^>]*class=""totalCount""[^>]*>전체\s*<strong>\s*(\d+)\s*</strong>\s*건</p>",
|
||||
@"전체\s*<strong>\s*(\d+)\s*</strong>\s*건",
|
||||
@"<strong>\s*(\d+)\s*</strong>\s*건",
|
||||
@"총\s*(\d+)\s*건"
|
||||
// 기본 패턴들
|
||||
@"전체\s*(?:\*\*)?(\d+)(?:\*\*)?\s*건", // 전체 **N** 건 또는 전체 N 건
|
||||
@"<h[1-6][^>]*>.*?전체\s*(?:\*\*)?(\d+)(?:\*\*)?\s*건.*?</h[1-6]>", // h태그 안의 전체 N 건
|
||||
@"<p[^>]*class=""totalCount""[^>]*>전체\s*<strong>\s*(\d+)\s*</strong>\s*건</p>", // 원래 패턴
|
||||
@"전체\s*<strong>\s*(\d+)\s*</strong>\s*건", // strong 태그
|
||||
@"<strong>\s*(\d+)\s*</strong>\s*건", // strong만
|
||||
@"총\s*(\d+)\s*건", // 총 N 건
|
||||
@"검색결과\s*:\s*(\d+)\s*건", // 검색결과: N 건
|
||||
@"(\d+)\s*건의\s*검색결과", // N 건의 검색결과
|
||||
};
|
||||
|
||||
foreach (var pattern in patterns)
|
||||
{
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase);
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase | RegexOptions.Singleline);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
@@ -160,25 +207,31 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value; // 매칭된 부분만 저장
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"광주동구 검색 결과: {count}건");
|
||||
Console.WriteLine($"광주동구 검색 결과: {count}건 (패턴: {pattern})");
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 더 자세한 패턴으로 시도 (줄바꿈 포함)
|
||||
// 3. 멀티라인 패턴으로 재시도
|
||||
var multilinePatterns = new[]
|
||||
{
|
||||
@"전체\s*<strong>\s*\r?\n?\s*(\d+)\s*\r?\n?\s*</strong>\s*건",
|
||||
@"<strong>\s*\r?\n?\s*(\d+)\s*\r?\n?\s*</strong>\s*건"
|
||||
@"전체\s*(?:\*\*)?[\r\n\s]*(\d+)[\r\n\s]*(?:\*\*)?\s*건",
|
||||
@"전체\s*<strong>\s*[\r\n]*\s*(\d+)\s*[\r\n]*\s*</strong>\s*건",
|
||||
@"<strong>\s*[\r\n]*\s*(\d+)\s*[\r\n]*\s*</strong>\s*건"
|
||||
};
|
||||
|
||||
foreach (var pattern in multilinePatterns)
|
||||
{
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Singleline);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
@@ -186,15 +239,24 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value; // 매칭된 부분만 저장
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"광주동구 검색 결과: {count}건");
|
||||
Console.WriteLine($"광주동구 검색 결과: {count}건 (멀티라인 패턴)");
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 4. 패턴을 찾지 못한 경우 - 디버깅을 위한 HTML 내용 일부 출력
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
Console.WriteLine($"광주동구 HTML 샘플: {resulthtml}");
|
||||
|
||||
errorMessage = "검색결과 패턴을 찾을 수 없음";
|
||||
Console.WriteLine("광주동구 검색결과 패턴을 찾을 수 없음");
|
||||
return -1;
|
||||
@@ -202,6 +264,8 @@ namespace BokBonCheck
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = $"결과 분석 오류: {ex.Message}";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음"; // 오류 시 HTML 일부 저장
|
||||
Console.WriteLine($"광주동구 결과 분석 오류: {ex.Message}");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -210,5 +274,83 @@ namespace BokBonCheck
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 문자열에 한글이 포함되어 있는지 확인
|
||||
/// </summary>
|
||||
private bool ContainsKorean(string text)
|
||||
{
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return false;
|
||||
|
||||
foreach (char c in text)
|
||||
{
|
||||
if (c >= 0xAC00 && c <= 0xD7A3) // 한글 유니코드 범위
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -337,7 +337,8 @@ namespace BokBonCheck
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
// 검색 결과 수 추출 (페이징 포함)
|
||||
var (resultCount, ermsg) = await ExtractBookCountWithPaging(_driver, searchTerm);
|
||||
var (resultCount, ermsg, resultHtml) = await ExtractBookCountWithPaging(_driver, searchTerm);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -362,13 +363,15 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private async Task<(int count, string message)> ExtractBookCountWithPaging(IWebDriver driver, string searchTerm)
|
||||
private async Task<(int count, string message, string resultHtml)> ExtractBookCountWithPaging(IWebDriver driver, string searchTerm)
|
||||
{
|
||||
string errmessage = string.Empty;
|
||||
int totalCount = 0;
|
||||
|
||||
try
|
||||
{
|
||||
var htmlContent = driver.PageSource;
|
||||
string resultHtml = string.Empty;
|
||||
// 첫 번째 페이지에서 테이블 row 수 확인
|
||||
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
|
||||
|
||||
@@ -381,7 +384,28 @@ namespace BokBonCheck
|
||||
if (firstPageRows.Count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return (0, errmessage);
|
||||
// "검색결과가 없습니다"와 같은 메시지를 찾아 context 추출 시도
|
||||
var noResultPatterns = new[]
|
||||
{
|
||||
@"검색결과가 없습니다",
|
||||
@"검색된 자료가 없습니다",
|
||||
@"자료가 없습니다"
|
||||
};
|
||||
|
||||
foreach (var pattern in noResultPatterns)
|
||||
{
|
||||
if (htmlContent.Contains(pattern))
|
||||
{
|
||||
var match = System.Text.RegularExpressions.Regex.Match(htmlContent, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
resultHtml = ExtractResultContext(htmlContent, match);
|
||||
return (0, errmessage, resultHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultHtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
return (0, errmessage, resultHtml);
|
||||
}
|
||||
|
||||
totalCount += firstPageRows.Count;
|
||||
@@ -390,7 +414,28 @@ namespace BokBonCheck
|
||||
catch
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return (0, errmessage);
|
||||
// "검색결과가 없습니다"와 같은 메시지를 찾아 context 추출 시도
|
||||
var noResultPatterns = new[]
|
||||
{
|
||||
@"검색결과가 없습니다",
|
||||
@"검색된 자료가 없습니다",
|
||||
@"자료가 없습니다"
|
||||
};
|
||||
|
||||
foreach (var pattern in noResultPatterns)
|
||||
{
|
||||
if (htmlContent.Contains(pattern))
|
||||
{
|
||||
var match = System.Text.RegularExpressions.Regex.Match(htmlContent, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
resultHtml = ExtractResultContext(htmlContent, match);
|
||||
return (0, errmessage, resultHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultHtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
return (0, errmessage, resultHtml);
|
||||
}
|
||||
|
||||
// 페이징이 있는지 확인하고 각 페이지 방문
|
||||
@@ -436,18 +481,42 @@ namespace BokBonCheck
|
||||
if (totalCount == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return (0, errmessage);
|
||||
// "검색결과가 없습니다"와 같은 메시지를 찾아 context 추출 시도
|
||||
var noResultPatterns = new[]
|
||||
{
|
||||
@"검색결과가 없습니다",
|
||||
@"검색된 자료가 없습니다",
|
||||
@"자료가 없습니다",
|
||||
@"전체\s*0\s*건"
|
||||
};
|
||||
|
||||
foreach (var pattern in noResultPatterns)
|
||||
{
|
||||
if (htmlContent.Contains(pattern))
|
||||
{
|
||||
var match = System.Text.RegularExpressions.Regex.Match(htmlContent, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
resultHtml = ExtractResultContext(htmlContent, match);
|
||||
return (0, errmessage, resultHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
resultHtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
return (0, errmessage, resultHtml);
|
||||
}
|
||||
|
||||
resultHtml = $"검색성공 - 총 {totalCount}건";
|
||||
errmessage = $"검색성공({totalCount}권)";
|
||||
Console.WriteLine($"전체 검색 결과: {totalCount}건");
|
||||
return (totalCount, errmessage);
|
||||
return (totalCount, errmessage, resultHtml);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
return (-1, errmessage);
|
||||
string resultHtml = "오류 발생";
|
||||
return (-1, errmessage, resultHtml);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,5 +561,67 @@ namespace BokBonCheck
|
||||
Console.WriteLine($"페이지 변경 감지 실패: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, System.Text.RegularExpressions.Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = System.Text.RegularExpressions.Regex.Matches(searchText, tagPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = System.Text.RegularExpressions.Regex.Match(tagMatch.Value, @"<(\w+)", System.Text.RegularExpressions.RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = System.Text.RegularExpressions.Regex.Match(searchText, closeTagPattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ namespace BokBonCheck
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
//request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@@ -84,7 +84,8 @@ namespace BokBonCheck
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage);
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
@@ -112,9 +113,10 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage, out string resulthtml)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -124,6 +126,7 @@ namespace BokBonCheck
|
||||
htmlContent.Contains("자료가 없습니다"))
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -146,8 +149,11 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
@@ -171,20 +177,25 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 패턴을 찾지 못한 경우
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
errorMessage = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = $"결과 분석 오류: {ex.Message}";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -193,5 +204,67 @@ namespace BokBonCheck
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,8 +107,9 @@ namespace BokBonCheck
|
||||
// JavaScript 렌더링 대기
|
||||
await Task.Delay(3000);
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg);
|
||||
var htmlContent = _driver.PageSource;
|
||||
var resultCount = ExtractBookCount(htmlContent, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -133,71 +134,21 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// JavaScript 실행 후 실제 렌더링된 DOM에서 결과 추출
|
||||
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
|
||||
|
||||
// 1. 검색결과가 없는 경우 확인
|
||||
try
|
||||
{
|
||||
var noResultElements = driver.FindElements(By.XPath("//*[contains(text(), '검색결과가 없습니다') or contains(text(), '검색된 자료가 없습니다')]"));
|
||||
if (noResultElements.Count > 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 검색결과가 있는 경우로 진행
|
||||
}
|
||||
|
||||
// 2. total_area에서 결과 수량 추출 (JavaScript 렌더링 후)
|
||||
try
|
||||
{
|
||||
var totalAreaElement = wait.Until(d => d.FindElement(By.CssSelector("div.total_area p.total span")));
|
||||
if (totalAreaElement != null)
|
||||
{
|
||||
var countText = totalAreaElement.Text.Trim();
|
||||
Console.WriteLine($"total_area 텍스트: '{countText}'");
|
||||
|
||||
// "총 3건" 형태에서 숫자 추출
|
||||
var match = Regex.Match(countText, @"총\s*(\d+)\s*건", RegexOptions.IgnoreCase);
|
||||
if (match.Success && int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
Console.WriteLine("검색 결과: 0건");
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"검색 결과: {count}건");
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
Console.WriteLine($"total_area 요소 추출 실패: {ex1.Message}");
|
||||
}
|
||||
|
||||
// 3. 페이지 소스에서 렌더링된 결과 추출
|
||||
var pageSource = driver.PageSource;
|
||||
Console.WriteLine("페이지 소스에서 결과 추출 시도");
|
||||
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
if (pageSource.Contains("검색결과가 없습니다") ||
|
||||
pageSource.Contains("검색된 자료가 없습니다") ||
|
||||
pageSource.Contains("자료가 없습니다") ||
|
||||
pageSource.Contains("총 0건"))
|
||||
if (htmlContent.Contains("검색결과가 없습니다") ||
|
||||
htmlContent.Contains("검색된 자료가 없습니다") ||
|
||||
htmlContent.Contains("자료가 없습니다") ||
|
||||
htmlContent.Contains("총 0건"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -212,11 +163,14 @@ namespace BokBonCheck
|
||||
|
||||
foreach (var pattern in htmlPatterns)
|
||||
{
|
||||
var match = Regex.Match(pageSource, pattern, RegexOptions.IgnoreCase);
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
// 매칭된 부분과 상위 태그 추출하여 resulthtml에 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
@@ -229,16 +183,80 @@ namespace BokBonCheck
|
||||
}
|
||||
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 완전한 페이지 로딩 대기 메서드
|
||||
private async Task WaitForCompletePageLoad(WebDriverWait wait)
|
||||
{
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace BokBonCheck
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
//request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@@ -84,7 +84,8 @@ namespace BokBonCheck
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage);
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
@@ -110,9 +111,10 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
try
|
||||
{
|
||||
// 실제 HTML 구조에 맞는 패턴으로 수정
|
||||
@@ -139,6 +141,7 @@ namespace BokBonCheck
|
||||
if (pattern.Contains(@"\s*0\s*"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -148,17 +151,21 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errmessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 디버깅을 위해 HTML 내용 일부 출력
|
||||
// 패턴을 찾지 못한 경우
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
Console.WriteLine($"HTML 내용 일부: {htmlContent.Substring(0, Math.Min(1000, htmlContent.Length))}");
|
||||
|
||||
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
return -1;
|
||||
|
||||
@@ -166,6 +173,7 @@ namespace BokBonCheck
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -177,5 +185,66 @@ namespace BokBonCheck
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,8 +227,9 @@ namespace BokBonCheck
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg);
|
||||
var htmlContent = _driver.PageSource;
|
||||
var resultCount = ExtractBookCount(htmlContent, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -253,71 +254,20 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 1. search-info div에서 직접 추출 시도
|
||||
try
|
||||
{
|
||||
var searchInfoElement = driver.FindElement(By.CssSelector("div.search-info"));
|
||||
if (searchInfoElement != null)
|
||||
{
|
||||
var searchInfoText = searchInfoElement.Text;
|
||||
|
||||
// "총 N건이 검색되었습니다" 패턴 찾기
|
||||
var match = Regex.Match(searchInfoText, @"총\s*(\d+)\s*건이\s*검색되었습니다", RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
// <b> 태그에서 직접 숫자 추출 시도
|
||||
try
|
||||
{
|
||||
var boldElements = searchInfoElement.FindElements(By.TagName("b"));
|
||||
foreach (var boldElement in boldElements)
|
||||
{
|
||||
var boldText = boldElement.Text.Trim();
|
||||
if (int.TryParse(boldText, out int boldCount))
|
||||
{
|
||||
if (boldCount == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({boldCount}권)";
|
||||
return boldCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"search-info 요소 검색 중 오류: {ex.Message}");
|
||||
}
|
||||
|
||||
// 2. 페이지 소스에서 정규식으로 추출 시도
|
||||
var pageSource = driver.PageSource;
|
||||
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
if (pageSource.Contains("0건이 검색되었습니다") ||
|
||||
pageSource.Contains("검색결과가 없습니다") ||
|
||||
pageSource.Contains("검색된 자료가 없습니다"))
|
||||
if (htmlContent.Contains("0건이 검색되었습니다") ||
|
||||
htmlContent.Contains("검색결과가 없습니다") ||
|
||||
htmlContent.Contains("검색된 자료가 없습니다"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -332,11 +282,14 @@ namespace BokBonCheck
|
||||
|
||||
foreach (var pattern in htmlPatterns)
|
||||
{
|
||||
var match = Regex.Match(pageSource, pattern, RegexOptions.IgnoreCase);
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
// 매칭된 부분과 상위 태그 추출하여 resulthtml에 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
@@ -349,16 +302,80 @@ namespace BokBonCheck
|
||||
}
|
||||
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
public async Task WaitForPageChange(WebDriverWait wait)
|
||||
{
|
||||
|
||||
263
unimarc/unimarc/SearchModel/JeonnamProvLibSearcher.cs
Normal file
263
unimarc/unimarc/SearchModel/JeonnamProvLibSearcher.cs
Normal file
@@ -0,0 +1,263 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using UniMarc.SearchModel;
|
||||
using System.Text;
|
||||
using OpenQA.Selenium.Support.UI;
|
||||
|
||||
namespace BokBonCheck
|
||||
{
|
||||
public class JeonnamProvLibSearcher : ILibrarySearcher
|
||||
{
|
||||
public string AreaCode { get; set; } = string.Empty;
|
||||
public string SiteName { get; protected set; }
|
||||
public string SiteUrl => "https://lib.jeonnam.go.kr/plus/search_list.php";
|
||||
public bool HttpApiMode { get; set; } = true;
|
||||
|
||||
public int No { get; set; }
|
||||
|
||||
private static readonly HttpClient _httpClient = new HttpClient()
|
||||
{
|
||||
DefaultRequestHeaders =
|
||||
{
|
||||
{ "User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" }
|
||||
}
|
||||
};
|
||||
|
||||
public JeonnamProvLibSearcher(int no, string areaCode, string areaName)
|
||||
{
|
||||
this.No = no;
|
||||
this.AreaCode = areaCode;
|
||||
this.SiteName = $"전라남도립({areaName})";
|
||||
}
|
||||
|
||||
public async Task StartDriver(bool showdriver = false)
|
||||
{
|
||||
// HTTP 클라이언트 사용으로 별도 드라이버 불필요
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void StopDriver()
|
||||
{
|
||||
// HTTP 클라이언트 사용으로 별도 정리 불필요
|
||||
}
|
||||
|
||||
public async Task<BookSearchResult> SearchAsync(string searchTerm)
|
||||
{
|
||||
var result = new BookSearchResult
|
||||
{
|
||||
SiteName = SiteName,
|
||||
SearchTerm = searchTerm,
|
||||
SearchTime = DateTime.Now
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
// 검색어 URL 인코딩
|
||||
var encodedSearchTerm = HttpUtility.UrlEncode(searchTerm, Encoding.UTF8);
|
||||
|
||||
// 실제 검색 URL 구성 (사용자가 확인한 정확한 파라미터 사용)
|
||||
var searchUrl = $"{SiteUrl}?act=1&aon1=AND&msa=M&jongbook=1&value1={encodedSearchTerm}&field1=IAL&formclass=&local=&sort=";
|
||||
|
||||
Console.WriteLine($"전라남도립도서관 검색 URL: {searchUrl}");
|
||||
|
||||
// HTTP GET 요청 실행 (추가 헤더 포함)
|
||||
using (var request = new HttpRequestMessage(HttpMethod.Get, searchUrl))
|
||||
{
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
request.Headers.Add("Referer", "https://lib.jeonnam.go.kr/plus/search_simple.php");
|
||||
|
||||
var response = await _httpClient.SendAsync(request);
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
var errorContent = await response.Content.ReadAsStringAsync();
|
||||
throw new HttpRequestException($"HTTP {(int)response.StatusCode} {response.StatusCode}: {errorContent}");
|
||||
}
|
||||
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
result.IsSuccess = false;
|
||||
result.ErrorMessage = errorMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.BookCount = resultCount;
|
||||
result.IsSuccess = true;
|
||||
result.ErrorMessage = $"검색성공({resultCount}권)";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
result.IsSuccess = false;
|
||||
result.ErrorMessage = $"검색 오류: {ex.Message}";
|
||||
result.BookCount = 0;
|
||||
Console.WriteLine($"전라남도립도서관 검색 오류: {ex.Message}");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage, out string resulthtml)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 전라남도립도서관 실제 HTML 패턴: <font>전체 1</font>개가 검색되었습니다
|
||||
var patterns = new[]
|
||||
{
|
||||
@"<font[^>]*>전체\s*(\d+)</font>\s*개가\s*검색되었습니다",
|
||||
@"'[^']*'\s*에\s*대하여\s*<font[^>]*>전체\s*(\d+)</font>\s*개가\s*검색되었습니다",
|
||||
@"전체\s*(\d+)\s*개가\s*검색되었습니다"
|
||||
};
|
||||
|
||||
foreach (var pattern in patterns)
|
||||
{
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Page X / Y 패턴으로도 확인 (총 페이지 수에서 결과 유무 판단)
|
||||
var pagePattern = @"Page\s*\d+\s*/\s*(\d+)";
|
||||
var pageMatch = Regex.Match(htmlContent, pagePattern, RegexOptions.IgnoreCase);
|
||||
if (pageMatch.Success)
|
||||
{
|
||||
if (int.TryParse(pageMatch.Groups[1].Value, out int totalPages))
|
||||
{
|
||||
if (totalPages == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = pageMatch.Value;
|
||||
return 0;
|
||||
}
|
||||
// 페이지가 있지만 정확한 개수를 알 수 없는 경우 -1 반환
|
||||
resulthtml = pageMatch.Value;
|
||||
errorMessage = "결과수량을찾을수없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
if (htmlContent.Contains("검색결과가 없습니다") ||
|
||||
htmlContent.Contains("검색된 자료가 없습니다") ||
|
||||
htmlContent.Contains("자료가 없습니다") ||
|
||||
htmlContent.Contains("개가 검색되었습니다") && !Regex.IsMatch(htmlContent, @"\d+\s*개가"))
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 패턴을 찾지 못한 경우
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
errorMessage = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = $"결과 분석 오류: {ex.Message}";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public Task WaitForPageChange(WebDriverWait wait)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,7 +260,8 @@ namespace BokBonCheck
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg);
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -285,11 +286,13 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage)
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
try
|
||||
{
|
||||
var htmlContent = driver.PageSource;
|
||||
// 먼저 검색결과가 없는 경우 확인
|
||||
try
|
||||
{
|
||||
@@ -298,6 +301,7 @@ namespace BokBonCheck
|
||||
if (noResultText.Contains("검색결과가 없습니다"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = noResultText;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -318,17 +322,36 @@ namespace BokBonCheck
|
||||
if (int.TryParse(match.Groups[1].Value, out int vqty))
|
||||
{
|
||||
errmessage = $"검색성공({vqty}건)";
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
return vqty;
|
||||
}
|
||||
else
|
||||
{
|
||||
errmessage = $"수량값오류({match.Groups[1].Value})";
|
||||
resulthtml = match.Value;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errmessage = "수량항목없음";
|
||||
// 매칭된 부분이 없는 경우, 기본적으로 pageInfoText 부분 추출 시도
|
||||
try
|
||||
{
|
||||
var dummyMatch = System.Text.RegularExpressions.Regex.Match(pageInfoText, @"전체.*");
|
||||
if (dummyMatch.Success)
|
||||
{
|
||||
resulthtml = ExtractResultContext(htmlContent, dummyMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -336,6 +359,7 @@ namespace BokBonCheck
|
||||
{
|
||||
// page_info가 없는 경우 검색결과가 없는 것으로 판단
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = "검색결과 없음: " + ex.Message;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -343,11 +367,72 @@ namespace BokBonCheck
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = "ExtractBookCount 오류: " + ex.Message;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
public async Task WaitForPageChange(WebDriverWait wait)
|
||||
|
||||
@@ -272,7 +272,8 @@ namespace BokBonCheck
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg);
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -297,11 +298,13 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage)
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
try
|
||||
{
|
||||
var htmlContent = driver.PageSource;
|
||||
// 먼저 검색결과가 없는 경우 확인
|
||||
try
|
||||
{
|
||||
@@ -310,6 +313,7 @@ namespace BokBonCheck
|
||||
if (noResultText.Contains("검색결과가 없습니다"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = noResultText;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -330,17 +334,36 @@ namespace BokBonCheck
|
||||
if (int.TryParse(match.Groups[1].Value, out int vqty))
|
||||
{
|
||||
errmessage = $"검색성공({vqty}건)";
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
return vqty;
|
||||
}
|
||||
else
|
||||
{
|
||||
errmessage = $"수량값오류({match.Groups[1].Value})";
|
||||
resulthtml = match.Value;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errmessage = "수량항목없음";
|
||||
// 매칭된 부분이 없는 경우, 기본적으로 pageInfoText 부분 추출 시도
|
||||
try
|
||||
{
|
||||
var dummyMatch = System.Text.RegularExpressions.Regex.Match(pageInfoText, @"전체.*");
|
||||
if (dummyMatch.Success)
|
||||
{
|
||||
resulthtml = ExtractResultContext(htmlContent, dummyMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -348,6 +371,27 @@ namespace BokBonCheck
|
||||
{
|
||||
// page_info가 없는 경우 검색결과가 없는 것으로 판단
|
||||
errmessage = "검색결과없음";
|
||||
// "검색결과가 없습니다"와 같은 메시지를 찾아 context 추출 시도
|
||||
var noResultPatterns = new[]
|
||||
{
|
||||
@"검색결과가 없습니다",
|
||||
@"검색된 자료가 없습니다",
|
||||
@"자료가 없습니다"
|
||||
};
|
||||
|
||||
foreach (var pattern in noResultPatterns)
|
||||
{
|
||||
if (htmlContent.Contains(pattern))
|
||||
{
|
||||
var match = System.Text.RegularExpressions.Regex.Match(htmlContent, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -355,11 +399,72 @@ namespace BokBonCheck
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = "ExtractBookCount 오류: " + ex.Message;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
public async Task WaitForPageChange(WebDriverWait wait)
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace BokBonCheck
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
//request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@@ -100,7 +100,8 @@ namespace BokBonCheck
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage);
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
@@ -128,9 +129,10 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage, out string resulthtml)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -141,6 +143,7 @@ namespace BokBonCheck
|
||||
htmlContent.Contains("총 0 건이 검색되었습니다"))
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -163,8 +166,11 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"KCM자료검색시스템 검색 결과: {count}건");
|
||||
return count;
|
||||
@@ -189,15 +195,19 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"KCM자료검색시스템 검색 결과: {count}건");
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 패턴을 찾지 못한 경우
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
errorMessage = "검색결과 패턴을 찾을 수 없음";
|
||||
Console.WriteLine("KCM자료검색시스템 검색결과 패턴을 찾을 수 없음");
|
||||
return -1;
|
||||
@@ -205,6 +215,7 @@ namespace BokBonCheck
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = $"결과 분석 오류: {ex.Message}";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -213,5 +224,67 @@ namespace BokBonCheck
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ using OpenQA.Selenium.Chromium;
|
||||
|
||||
namespace BokBonCheck
|
||||
{
|
||||
public class KwangjuCityEduLibrarySearcher : ILibrarySearcher
|
||||
public class KwangjuCityEduLibrarySearcher : ILibrarySearcher
|
||||
{
|
||||
public int No { get; set; }
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace BokBonCheck
|
||||
try
|
||||
{
|
||||
if (SeleniumHelper.IsReady == false) await SeleniumHelper.Download();
|
||||
_driver = await SeleniumHelper.CreateDriver(ShowBrowser:showBrowser);
|
||||
_driver = await SeleniumHelper.CreateDriver(ShowBrowser: showBrowser);
|
||||
Console.WriteLine("KwangjuCityLibrarySearcher Driver 초기화 완료");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -94,7 +94,7 @@ namespace BokBonCheck
|
||||
_driver.Navigate().GoToUrl(SiteUrl);
|
||||
|
||||
// 페이지 로딩 대기
|
||||
var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(15));
|
||||
var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(30));
|
||||
|
||||
// 모든 감지 방법이 끝나면 크롬창 최소화
|
||||
// whale 브라우저가 최소화되어 우선해제
|
||||
@@ -190,13 +190,24 @@ namespace BokBonCheck
|
||||
}
|
||||
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(30)));
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver);
|
||||
var resultCount = ExtractBookCount(_driver, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
result.BookCount = resultCount;
|
||||
result.IsSuccess = true;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
result.IsSuccess = false;
|
||||
result.ErrorMessage = errorMessage;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.BookCount = resultCount;
|
||||
result.IsSuccess = true;
|
||||
result.ErrorMessage = errorMessage;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -204,14 +215,21 @@ namespace BokBonCheck
|
||||
result.ErrorMessage = ex.Message;
|
||||
result.BookCount = 0;
|
||||
}
|
||||
|
||||
finally
|
||||
{
|
||||
await Task.Delay(1000);//.Threading.Thread.Sleep(500);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver)
|
||||
private int ExtractBookCount(IWebDriver driver, out string errorMessage, out string resulthtml)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
try
|
||||
{
|
||||
var htmlContent = driver.PageSource;
|
||||
|
||||
// div.search-result 내부의 span에서 '전체 N' 텍스트 추출
|
||||
var resultDiv = driver.FindElement(By.CssSelector("div.ndls_result"));
|
||||
var span = resultDiv.FindElement(By.XPath(".//span[contains(text(),'전체')]"));
|
||||
@@ -219,13 +237,106 @@ namespace BokBonCheck
|
||||
var match = System.Text.RegularExpressions.Regex.Match(text, @"전체\s*(\d+)");
|
||||
if (match.Success)
|
||||
{
|
||||
return int.Parse(match.Groups[1].Value);
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = text;
|
||||
return 0;
|
||||
}
|
||||
errorMessage = $"검색성공({count}건)";
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
return count;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
errorMessage = "수량항목없음";
|
||||
// 매칭된 부분이 없는 경우, 기본적으로 text 부분 추출 시도
|
||||
try
|
||||
{
|
||||
var dummyMatch = System.Text.RegularExpressions.Regex.Match(text, @"전체.*");
|
||||
if (dummyMatch.Success)
|
||||
{
|
||||
resulthtml = ExtractResultContext(htmlContent, dummyMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0;
|
||||
errorMessage = ex.Message;
|
||||
resulthtml = "오류발생";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace BokBonCheck
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
//request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@@ -92,7 +92,8 @@ namespace BokBonCheck
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage);
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
@@ -120,9 +121,10 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage, out string resulthtml)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -146,8 +148,11 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
@@ -161,6 +166,7 @@ namespace BokBonCheck
|
||||
htmlContent.Contains("총 0권(개)"))
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -183,20 +189,25 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 패턴을 찾지 못한 경우
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
errorMessage = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = $"결과 분석 오류: {ex.Message}";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -205,5 +216,67 @@ namespace BokBonCheck
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,9 +196,9 @@ namespace BokBonCheck
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg);
|
||||
var htmlContent = _driver.PageSource;
|
||||
var resultCount = ExtractBookCount(htmlContent, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -223,71 +223,56 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 검색결과 페이지 대기
|
||||
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
|
||||
|
||||
// 1. 검색결과가 없는 경우 확인
|
||||
try
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
var noResultPatterns = new[]
|
||||
{
|
||||
var noResultElements = driver.FindElements(By.XPath("//*[contains(text(), '검색결과가 없습니다') or contains(text(), '검색된 자료가 없습니다')]"));
|
||||
if (noResultElements.Count > 0)
|
||||
@"검색결과가 없습니다",
|
||||
@"검색된 자료가 없습니다",
|
||||
@"자료가 없습니다",
|
||||
@"전체 <strong>0</strong> 건"
|
||||
};
|
||||
|
||||
foreach (var pattern in noResultPatterns)
|
||||
{
|
||||
if (htmlContent.Contains(pattern))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
// 검색결과 없음 메시지를 포함한 HTML 조각 추출
|
||||
var index = htmlContent.IndexOf(pattern);
|
||||
if (index >= 0)
|
||||
{
|
||||
var startIndex = Math.Max(0, index - 100);
|
||||
var endIndex = Math.Min(htmlContent.Length, index + pattern.Length + 100);
|
||||
resulthtml = htmlContent.Substring(startIndex, endIndex - startIndex);
|
||||
|
||||
// 상위 태그 찾기 시도
|
||||
try
|
||||
{
|
||||
var match = System.Text.RegularExpressions.Regex.Match(htmlContent, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 실패시 기본 추출 결과 사용
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resulthtml = pattern;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 검색결과가 있는 경우로 진행
|
||||
}
|
||||
|
||||
// 2. totalCount에서 결과 수량 추출
|
||||
try
|
||||
{
|
||||
var totalCountElement = wait.Until(d => d.FindElement(By.CssSelector("p.totalCount strong")));
|
||||
if (totalCountElement != null)
|
||||
{
|
||||
var countText = totalCountElement.Text.Trim();
|
||||
Console.WriteLine($"totalCount 텍스트: '{countText}'");
|
||||
|
||||
if (int.TryParse(countText, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
Console.WriteLine("검색 결과: 0건");
|
||||
return 0;
|
||||
}
|
||||
errmessage = $"검색성공({count}권)";
|
||||
Console.WriteLine($"검색 결과: {count}건");
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
Console.WriteLine($"totalCount 요소 추출 실패: {ex1.Message}");
|
||||
}
|
||||
|
||||
// 3. 페이지 소스에서 결과 추출
|
||||
var pageSource = driver.PageSource;
|
||||
Console.WriteLine("페이지 소스에서 결과 추출 시도");
|
||||
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
if (pageSource.Contains("검색결과가 없습니다") ||
|
||||
pageSource.Contains("검색된 자료가 없습니다") ||
|
||||
pageSource.Contains("자료가 없습니다") ||
|
||||
pageSource.Contains("전체 <strong>0</strong> 건"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
// HTML에서 다양한 패턴 찾기
|
||||
var htmlPatterns = new[]
|
||||
@@ -299,11 +284,14 @@ namespace BokBonCheck
|
||||
|
||||
foreach (var pattern in htmlPatterns)
|
||||
{
|
||||
var match = Regex.Match(pageSource, pattern, RegexOptions.IgnoreCase);
|
||||
var match = Regex.Match(htmlContent, pattern, RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
// 매칭된 부분과 상위 태그 추출하여 resulthtml에 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
@@ -316,16 +304,80 @@ namespace BokBonCheck
|
||||
}
|
||||
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
resulthtml = "결과수량을찾을수없음";
|
||||
return -1;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = "ExtractBookCount 오류: " + ex.Message;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 완전한 페이지 로딩 대기 메서드
|
||||
private async Task WaitForCompletePageLoad(WebDriverWait wait)
|
||||
{
|
||||
|
||||
@@ -269,7 +269,8 @@ namespace BokBonCheck
|
||||
await WaitForPageChange(new WebDriverWait(_driver, TimeSpan.FromSeconds(15)));
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg);
|
||||
var resultCount = ExtractBookCount(_driver, searchTerm, out string ermsg, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
if (resultCount == -1)
|
||||
{
|
||||
result.BookCount = 0;
|
||||
@@ -294,11 +295,14 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage)
|
||||
private int ExtractBookCount(IWebDriver driver, string searchTerm, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
try
|
||||
{
|
||||
var htmlContent = driver.PageSource;
|
||||
|
||||
// div.search-result 내부의 span에서 '전체 N' 텍스트 추출
|
||||
var resultDiv = driver.FindElement(By.CssSelector("div.search-result"));
|
||||
|
||||
@@ -306,6 +310,7 @@ namespace BokBonCheck
|
||||
if (bodytext.Contains("검색결과가 없습니다"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = bodytext;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -315,6 +320,7 @@ namespace BokBonCheck
|
||||
if (searchTerm.Contains(searchtitle) == false)
|
||||
{
|
||||
errmessage = $"검색어불일치({searchtitle}/{searchTerm})";
|
||||
resulthtml = searchtitle;
|
||||
return -1;
|
||||
}
|
||||
var span = resultDiv.FindElement(By.XPath(".//span[contains(text(),'전체')]"));
|
||||
@@ -325,10 +331,13 @@ namespace BokBonCheck
|
||||
if (int.TryParse(match.Groups[1].Value, out int vqty) == false)
|
||||
{
|
||||
errmessage = $"수량값오류({match.Groups[1].Value})";
|
||||
resulthtml = match.Value;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
errmessage = $"검색성공({vqty}건)";
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
searchTerm = string.Empty;
|
||||
return vqty;
|
||||
}
|
||||
@@ -336,6 +345,23 @@ namespace BokBonCheck
|
||||
else
|
||||
{
|
||||
errmessage = "수량항목없음";
|
||||
// 매칭된 부분이 없는 경우, 기본적으로 text 부분 추출 시도
|
||||
try
|
||||
{
|
||||
var dummyMatch = System.Text.RegularExpressions.Regex.Match(text, @"전체.*");
|
||||
if (dummyMatch.Success)
|
||||
{
|
||||
resulthtml = ExtractResultContext(htmlContent, dummyMatch);
|
||||
}
|
||||
else
|
||||
{
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
resulthtml = htmlContent.Length > 500 ? htmlContent.Substring(0, 500) : htmlContent;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -343,11 +369,72 @@ namespace BokBonCheck
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = "ExtractBookCount 오류: " + ex.Message;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지 변경을 감지하는 메서드
|
||||
public async Task WaitForPageChange(WebDriverWait wait)
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace BokBonCheck
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
//request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@@ -97,7 +97,8 @@ namespace BokBonCheck
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage);
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
@@ -125,9 +126,10 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage, out string resulthtml)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -150,8 +152,11 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
@@ -165,6 +170,7 @@ namespace BokBonCheck
|
||||
htmlContent.Contains("총 0건"))
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -178,8 +184,10 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = resultConMatch.Value;
|
||||
return 0;
|
||||
}
|
||||
resulthtml = ExtractResultContext(htmlContent, resultConMatch);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
@@ -203,20 +211,25 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 패턴을 찾지 못한 경우
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
errorMessage = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = $"결과 분석 오류: {ex.Message}";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -225,5 +238,67 @@ namespace BokBonCheck
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace BokBonCheck
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
//request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@@ -96,7 +96,8 @@ namespace BokBonCheck
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage);
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
@@ -122,15 +123,17 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errmessage, out string resulthtml)
|
||||
{
|
||||
errmessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
try
|
||||
{
|
||||
// 검색 결과가 없다는 메시지 확인
|
||||
if (htmlContent.Contains("0권(개)") || htmlContent.Contains("검색결과가 없습니다"))
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = "검색결과없음";
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -153,14 +156,19 @@ namespace BokBonCheck
|
||||
if (count == 0)
|
||||
{
|
||||
errmessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errmessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 패턴을 찾지 못한 경우
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
errmessage = "결과수량을찾을수없음";
|
||||
return -1;
|
||||
|
||||
@@ -168,6 +176,7 @@ namespace BokBonCheck
|
||||
catch (Exception ex)
|
||||
{
|
||||
errmessage = ex.Message;
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -178,5 +187,67 @@ namespace BokBonCheck
|
||||
// HTTP 방식에서는 즉시 응답이 오므로 대기 불필요
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace BokBonCheck
|
||||
// 브라우저와 유사한 헤더 추가
|
||||
request.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
|
||||
request.Headers.Add("Accept-Language", "ko-KR,ko;q=0.8,en-US;q=0.5,en;q=0.3");
|
||||
request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
//request.Headers.Add("Accept-Encoding", "gzip, deflate, br");
|
||||
request.Headers.Add("Connection", "keep-alive");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", "1");
|
||||
|
||||
@@ -92,7 +92,8 @@ namespace BokBonCheck
|
||||
var htmlContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
// 검색 결과 수 추출
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage);
|
||||
var resultCount = ExtractBookCount(htmlContent, out string errorMessage, out string resultHtml);
|
||||
result.Resulthtml = resultHtml;
|
||||
|
||||
if (resultCount == -1)
|
||||
{
|
||||
@@ -120,9 +121,10 @@ namespace BokBonCheck
|
||||
return result;
|
||||
}
|
||||
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage)
|
||||
private int ExtractBookCount(string htmlContent, out string errorMessage, out string resulthtml)
|
||||
{
|
||||
errorMessage = string.Empty;
|
||||
resulthtml = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -134,12 +136,21 @@ namespace BokBonCheck
|
||||
{
|
||||
if (int.TryParse(match.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = match.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, match);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMessage = $"수량값오류({match.Groups[1].Value})";
|
||||
resulthtml = match.Value;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -153,11 +164,21 @@ namespace BokBonCheck
|
||||
{
|
||||
if (int.TryParse(alternateMatch.Groups[1].Value, out int count))
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
errorMessage = "검색결과없음";
|
||||
resulthtml = alternateMatch.Value;
|
||||
return 0;
|
||||
}
|
||||
// 매칭된 부분과 그 상위 태그를 찾아서 저장
|
||||
resulthtml = ExtractResultContext(htmlContent, alternateMatch);
|
||||
errorMessage = $"검색성공({count}권)";
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 패턴을 찾지 못한 경우
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
errorMessage = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
@@ -165,6 +186,7 @@ namespace BokBonCheck
|
||||
catch (Exception ex)
|
||||
{
|
||||
errorMessage = $"결과 분석 오류: {ex.Message}";
|
||||
resulthtml = "검색결과 패턴을 찾을 수 없음";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -173,5 +195,67 @@ namespace BokBonCheck
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 매칭된 결과와 그 상위 태그를 추출
|
||||
/// </summary>
|
||||
private string ExtractResultContext(string htmlContent, Match match)
|
||||
{
|
||||
try
|
||||
{
|
||||
var matchIndex = match.Index;
|
||||
var matchLength = match.Length;
|
||||
|
||||
// 매칭된 위치 앞쪽에서 상위 태그 시작 찾기
|
||||
var startSearchIndex = Math.Max(0, matchIndex - 200); // 매칭 위치 200자 전부터 검색
|
||||
var searchText = htmlContent.Substring(startSearchIndex, matchIndex - startSearchIndex + matchLength + Math.Min(200, htmlContent.Length - matchIndex - matchLength));
|
||||
|
||||
// 상위 태그 패턴들 (div, p, h1-h6, span 등)
|
||||
var tagPatterns = new[] { @"<(div|p|h[1-6]|span|section|article)[^>]*>", @"<[^>]+>" };
|
||||
|
||||
string resultContext = match.Value; // 기본값은 매칭된 부분만
|
||||
|
||||
foreach (var tagPattern in tagPatterns)
|
||||
{
|
||||
// 매칭된 부분 앞에서 가장 가까운 태그 시작 찾기
|
||||
var tagMatches = Regex.Matches(searchText, tagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
for (int i = tagMatches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var tagMatch = tagMatches[i];
|
||||
if (tagMatch.Index < (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 태그 이름 추출
|
||||
var tagName = Regex.Match(tagMatch.Value, @"<(\w+)", RegexOptions.IgnoreCase).Groups[1].Value;
|
||||
|
||||
// 닫는 태그 찾기
|
||||
var closeTagPattern = $@"</{tagName}[^>]*>";
|
||||
var closeMatch = Regex.Match(searchText, closeTagPattern, RegexOptions.IgnoreCase);
|
||||
|
||||
if (closeMatch.Success && closeMatch.Index > (matchIndex - startSearchIndex))
|
||||
{
|
||||
// 상위 태그와 그 내용을 포함하여 반환
|
||||
var startIdx = tagMatch.Index;
|
||||
var endIdx = closeMatch.Index + closeMatch.Length;
|
||||
resultContext = searchText.Substring(startIdx, Math.Min(endIdx - startIdx, 500)); // 최대 500자
|
||||
return resultContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상위 태그를 찾지 못한 경우, 매칭 전후 50자씩 포함
|
||||
var contextStart = Math.Max(0, matchIndex - 50);
|
||||
var contextEnd = Math.Min(htmlContent.Length, matchIndex + matchLength + 50);
|
||||
resultContext = htmlContent.Substring(contextStart, contextEnd - contextStart);
|
||||
|
||||
return resultContext;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"ExtractResultContext 오류: {ex.Message}");
|
||||
return match.Value; // 오류 시 매칭된 부분만 반환
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ using System.Drawing.Text;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using System.Data.SqlTypes;
|
||||
using AR;
|
||||
|
||||
namespace WindowsFormsApp1
|
||||
{
|
||||
@@ -63,7 +64,7 @@ namespace WindowsFormsApp1
|
||||
else
|
||||
dataGridView.Sort(dataGridView.Columns[col], System.ComponentModel.ListSortDirection.Ascending);
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// * Row헤더에 체크박스를 넣는 기능*
|
||||
@@ -99,7 +100,7 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
private void datagridview_checkBox_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach(DataGridViewRow r in ((DataGridView)sender).Rows)
|
||||
foreach (DataGridViewRow r in ((DataGridView)sender).Rows)
|
||||
{
|
||||
r.Cells["colCheck"].Value = ((CheckBox)sender).Checked;
|
||||
}
|
||||
@@ -119,23 +120,32 @@ namespace WindowsFormsApp1
|
||||
char[] columnSplitter = { '\t' };
|
||||
|
||||
//get the text from clipboard
|
||||
IDataObject dataInClipboard = Clipboard.GetDataObject();
|
||||
|
||||
string stringInClipboard = (string)dataInClipboard.GetData(DataFormats.Text);
|
||||
if (Clipboard.ContainsText() == false) return;
|
||||
|
||||
string stringInClipboard = null;
|
||||
|
||||
if (e.Alt)
|
||||
stringInClipboard = Clipboard.GetText(TextDataFormat.UnicodeText);
|
||||
else
|
||||
stringInClipboard = Clipboard.GetText();// (string)objdata;
|
||||
|
||||
//split it into lines
|
||||
//20230209 \r텝 기능과 \n 줄넘김 기능을 같이 공백 제거 처리해버려 공백칸을 활용해야 함에도 제거하는 현상 발생.
|
||||
//텝 공백 문자열 동시에 사용하여 분류
|
||||
// stringInClipboard= stringInClipboard.Replace("\r", "");
|
||||
if (stringInClipboard == null) return;
|
||||
List<string>rowsInClipboard = stringInClipboard.Split(rowSpliteter, StringSplitOptions.None).ToList();
|
||||
rowsInClipboard.RemoveAt(rowsInClipboard.Count-1);
|
||||
//get the row and column of selected cell in dataGridView1
|
||||
int r = ((DataGridView)sender).SelectedCells[0].RowIndex;
|
||||
int c = ((DataGridView)sender).SelectedCells[0].ColumnIndex;
|
||||
List<string> rowsInClipboard = stringInClipboard.Split(rowSpliteter, StringSplitOptions.None).ToList();
|
||||
if (rowsInClipboard.Last().isEmpty()) rowsInClipboard.RemoveAt(rowsInClipboard.Count - 1);
|
||||
|
||||
var dv = sender as DataGridView;
|
||||
|
||||
int r = dv.SelectedCells[0].RowIndex;
|
||||
int c = dv.SelectedCells[0].ColumnIndex;
|
||||
//add rows into dataGridView1 to fit clipboard lines
|
||||
if (((DataGridView)sender).Rows.Count < (r + rowsInClipboard.Count))
|
||||
if (dv.Rows.Count < (r + rowsInClipboard.Count))
|
||||
{
|
||||
((DataGridView)sender).Rows.Add(r + rowsInClipboard.Count - ((DataGridView)sender).Rows.Count);
|
||||
dv.Rows.Add(r + rowsInClipboard.Count - dv.Rows.Count);
|
||||
}
|
||||
// loop through the lines, split them into cells and place the values in the corresponding cell.
|
||||
for (int iRow = 0; iRow < rowsInClipboard.Count; iRow++)
|
||||
@@ -146,10 +156,10 @@ namespace WindowsFormsApp1
|
||||
for (int iCol = 0; iCol < valuesInRow.Length; iCol++)
|
||||
{
|
||||
//assign cell value, only if it within columns of the dataGridView1
|
||||
if (((DataGridView)sender).ColumnCount - 1 >= c + iCol)
|
||||
if (dv.ColumnCount - 1 >= c + iCol)
|
||||
{
|
||||
if (((DataGridView)sender).Rows.Count <= r + iRow) continue;
|
||||
((DataGridView)sender).Rows[r + iRow].Cells[c + iCol].Value = valuesInRow[iCol];
|
||||
if (dv.Rows.Count <= r + iRow) continue;
|
||||
dv.Rows[r + iRow].Cells[c + iCol].Value = valuesInRow[iCol];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -209,7 +219,7 @@ namespace WindowsFormsApp1
|
||||
private Rectangle dragBoxFromMouseDown;
|
||||
private int rowIndexFromMouseDown;
|
||||
private int rowIndexOfItemUnderMouseToDrop;
|
||||
|
||||
|
||||
public void MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
DataGridView dataGridView = sender as DataGridView;
|
||||
@@ -292,7 +302,8 @@ namespace WindowsFormsApp1
|
||||
string[] db_data = db_res1.Split('|');
|
||||
string[] db_pur = db_res2.Split('|');
|
||||
|
||||
if (db_res1.Length < 3) {
|
||||
if (db_res1.Length < 3)
|
||||
{
|
||||
MessageBox.Show("DB호출 에러!", "Error");
|
||||
return "False";
|
||||
}
|
||||
@@ -300,20 +311,26 @@ namespace WindowsFormsApp1
|
||||
string fax = string.Empty;
|
||||
string emchk = string.Empty;
|
||||
|
||||
if (db_pur.Length > 3) {
|
||||
for(int a= 0; a < db_pur.Length; a++)
|
||||
if (db_pur.Length > 3)
|
||||
{
|
||||
for (int a = 0; a < db_pur.Length; a++)
|
||||
{
|
||||
if (a % 3 == 0) { // 전화번호
|
||||
if (db_pur[a] != "") {
|
||||
if (a % 3 == 0)
|
||||
{ // 전화번호
|
||||
if (db_pur[a] != "")
|
||||
{
|
||||
tel = db_pur[a];
|
||||
}
|
||||
}
|
||||
if (a % 3 == 1) { // 팩스
|
||||
if (db_pur[a] != "") {
|
||||
if (a % 3 == 1)
|
||||
{ // 팩스
|
||||
if (db_pur[a] != "")
|
||||
{
|
||||
fax = db_pur[a];
|
||||
}
|
||||
}
|
||||
if (a % 3 == 2) { // 팩스 이메일 체크
|
||||
if (a % 3 == 2)
|
||||
{ // 팩스 이메일 체크
|
||||
emchk = db_pur[a];
|
||||
}
|
||||
}
|
||||
@@ -401,7 +418,7 @@ namespace WindowsFormsApp1
|
||||
#region 주문일자 / 보낸곳 (4행)
|
||||
rng = ws.Range["A4", "C4"];
|
||||
rng.MergeCells = true;
|
||||
rng.Value2 = "주문일자 : "+DateTime.Now.ToString("yyyy-MM-dd H:m:ss");
|
||||
rng.Value2 = "주문일자 : " + DateTime.Now.ToString("yyyy-MM-dd H:m:ss");
|
||||
rng.HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft;
|
||||
rng.Font.Bold = true;
|
||||
|
||||
@@ -495,7 +512,7 @@ namespace WindowsFormsApp1
|
||||
|
||||
#region 추신
|
||||
endcount++;
|
||||
string 발송처 = "D"+endcount.ToString();
|
||||
string 발송처 = "D" + endcount.ToString();
|
||||
|
||||
rng = ws.Range["A" + endcount, "C" + endcount];
|
||||
rng.MergeCells = true;
|
||||
@@ -551,7 +568,7 @@ namespace WindowsFormsApp1
|
||||
rng2.Font.Bold = true;
|
||||
|
||||
////////
|
||||
rng = ws.Range[발송처, "D"+endcount];
|
||||
rng = ws.Range[발송처, "D" + endcount];
|
||||
rng.MergeCells = true;
|
||||
rng.Value2 = "발 송 처";
|
||||
rng.Font.Bold = true;
|
||||
@@ -580,10 +597,10 @@ namespace WindowsFormsApp1
|
||||
|
||||
application.Interactive = true;
|
||||
application.Quit();
|
||||
|
||||
|
||||
return FileName;
|
||||
}
|
||||
catch(Exception e)
|
||||
catch (Exception e)
|
||||
{
|
||||
MessageBox.Show(e.ToString());
|
||||
return "False";
|
||||
@@ -630,9 +647,9 @@ namespace WindowsFormsApp1
|
||||
private string Excel_Sub(string[] data)
|
||||
{
|
||||
string[] length = {
|
||||
"1", "2", "3", "4", "5",
|
||||
"6", "7", "8", "9", "10",
|
||||
"11", "12", "13", "14", "15",
|
||||
"1", "2", "3", "4", "5",
|
||||
"6", "7", "8", "9", "10",
|
||||
"11", "12", "13", "14", "15",
|
||||
"16", "17", "18", "19", "20",
|
||||
"21", "22", "23", "24", "25", "26"
|
||||
};
|
||||
@@ -646,8 +663,8 @@ namespace WindowsFormsApp1
|
||||
|
||||
string count = data.Length.ToString();
|
||||
string res = string.Empty;
|
||||
|
||||
for(int a = 0; a < length.Length; a++)
|
||||
|
||||
for (int a = 0; a < length.Length; a++)
|
||||
{
|
||||
if (length[a] == count)
|
||||
{
|
||||
@@ -658,7 +675,7 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
public class Helper_Print
|
||||
public class Helper_Print
|
||||
{
|
||||
/// <summary>
|
||||
/// 행의 갯수
|
||||
@@ -788,7 +805,7 @@ namespace WindowsFormsApp1
|
||||
/// <param name="file_name"></param>
|
||||
/// <param name="fax_param">[0] 발신번호 / [1] 수신번호
|
||||
/// / [2] 수신자 회사명 / [3 ]수신자명 </param>
|
||||
public string Send_BaroFax(string file_name, string[] fax_param )
|
||||
public string Send_BaroFax(string file_name, string[] fax_param)
|
||||
{
|
||||
BaroService_FAXSoapClient fAXSoapClient = new BaroService_FAXSoapClient();
|
||||
|
||||
@@ -824,7 +841,7 @@ namespace WindowsFormsApp1
|
||||
BaroService_FAXSoapClient fAXSoapClient = new BaroService_FAXSoapClient();
|
||||
|
||||
// 수신자회사명, 수신번호, 전송일시, 전송결과, 전송페이지수, 성공페이지수, 전송파일명
|
||||
string[] MsgBox_Array = {
|
||||
string[] MsgBox_Array = {
|
||||
fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).ReceiveCorp,
|
||||
fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).ReceiverNum,
|
||||
fAXSoapClient.GetFaxMessage(CERTKEY, CorpNum, sendkey).SendDT,
|
||||
@@ -1190,9 +1207,9 @@ namespace WindowsFormsApp1
|
||||
public bool IsConnected { get; set; }
|
||||
|
||||
private string ipAddr = string.Empty;
|
||||
private string Port = string.Empty;
|
||||
private string Port = string.Empty;
|
||||
private string userId = string.Empty;
|
||||
private string Pwd = string.Empty;
|
||||
private string Pwd = string.Empty;
|
||||
|
||||
public FTP() { }
|
||||
|
||||
@@ -1219,7 +1236,7 @@ namespace WindowsFormsApp1
|
||||
using (ftpRequest.GetResponse()) { }
|
||||
this.IsConnected = true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LastException = ex;
|
||||
System.Reflection.MemberInfo info = System.Reflection.MethodInfo.GetCurrentMethod();
|
||||
@@ -1288,7 +1305,7 @@ namespace WindowsFormsApp1
|
||||
buff = null;
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.ToString());
|
||||
this.LastException = ex;
|
||||
@@ -1392,14 +1409,14 @@ namespace WindowsFormsApp1
|
||||
|
||||
if (reader != null) reader.Close();
|
||||
|
||||
foreach(string file in result.ToString().Split('\n'))
|
||||
foreach (string file in result.ToString().Split('\n'))
|
||||
{
|
||||
resultList.Add(file);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LastException = ex;
|
||||
|
||||
@@ -1420,12 +1437,12 @@ namespace WindowsFormsApp1
|
||||
|
||||
try
|
||||
{
|
||||
foreach(string tmpFolder in arrDir)
|
||||
foreach (string tmpFolder in arrDir)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (tmpFolder == string.Empty) continue;
|
||||
|
||||
|
||||
currentDir += @"/" + tmpFolder;
|
||||
|
||||
string url = string.Format(@"FTP://{0}:{1}/{2}", this.ipAddr, this.Port, currentDir);
|
||||
@@ -1453,9 +1470,11 @@ namespace WindowsFormsApp1
|
||||
private void checkDir(string localFullPathFile)
|
||||
{
|
||||
FileInfo finfo = new FileInfo(localFullPathFile);
|
||||
if (!finfo.Exists) {
|
||||
if (!finfo.Exists)
|
||||
{
|
||||
DirectoryInfo dInfo = new DirectoryInfo(finfo.DirectoryName);
|
||||
if (!dInfo.Exists) {
|
||||
if (!dInfo.Exists)
|
||||
{
|
||||
dInfo.Create();
|
||||
}
|
||||
}
|
||||
@@ -1552,30 +1571,35 @@ namespace WindowsFormsApp1
|
||||
int tDown = 0;
|
||||
for (int a = 0; a < array_text.Count; a++)
|
||||
{
|
||||
// if (array_text[a] == "") continue;
|
||||
// if (array_text[a] == "") continue;
|
||||
|
||||
num.Add(array_text[a].Substring(0, 3));
|
||||
|
||||
if (array_text[a][5] == '▼') {
|
||||
if (array_text[a][5] == '▼')
|
||||
{
|
||||
array_text[a] = array_text[a].Remove(0, 3);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
array_text[a] = array_text[a].Remove(0, 5);
|
||||
}
|
||||
|
||||
가변길이 += array_text[a] + "\n";
|
||||
int textLength = 0;
|
||||
if (EncodingType == "UTF-8") {
|
||||
if (EncodingType == "UTF-8")
|
||||
{
|
||||
textLength = Encoding.UTF8.GetBytes(array_text[a]).Length
|
||||
- WordCheck(array_text[a], "▲")
|
||||
- WordCheck(array_text[a], "▼");
|
||||
}
|
||||
else if (EncodingType == "UniCode") {
|
||||
else if (EncodingType == "UniCode")
|
||||
{
|
||||
textLength = Encoding.Unicode.GetBytes(array_text[a]).Length
|
||||
- WordCheck(array_text[a], "▲")
|
||||
- WordCheck(array_text[a], "▼");
|
||||
}
|
||||
else { // ANSI
|
||||
else
|
||||
{ // ANSI
|
||||
textLength = Encoding.Default.GetBytes(array_text[a]).Length
|
||||
- WordCheck(array_text[a], "▲")
|
||||
- WordCheck(array_text[a], "▼");
|
||||
@@ -1587,12 +1611,13 @@ namespace WindowsFormsApp1
|
||||
|
||||
for (int a = 0; a < array_text.Count; a++)
|
||||
{
|
||||
if (a == 0) { //total.Add("0");
|
||||
if (a == 0)
|
||||
{ //total.Add("0");
|
||||
tTotal.Add(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// total.Add(total[a - 1] + count[a - 1]);
|
||||
// total.Add(total[a - 1] + count[a - 1]);
|
||||
tTotal.Add(tTotal[a - 1] + tCount[a - 1]);
|
||||
}
|
||||
//else if (a == 1)
|
||||
@@ -1609,7 +1634,7 @@ namespace WindowsFormsApp1
|
||||
// else c = Convert.ToInt32(Encoding.Default.GetBytes(array_text[a - 2]).Length.ToString()) - WordCheck(array_text[a - 2], "▲") - WordCheck(array_text[a - 2], "▼");
|
||||
// int res = b + c;
|
||||
// total.Add(res.ToString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
string[] str_num = num.ToArray();
|
||||
@@ -1626,7 +1651,7 @@ namespace WindowsFormsApp1
|
||||
// else if (total[a].Length == 2) { total[a] = total[a].Insert(0, "000"); }
|
||||
// else if (total[a].Length == 1) { total[a] = total[a].Insert(0, "0000"); }
|
||||
// 디렉토리 += str_num[a] + count[a] + total[a] + "\n";
|
||||
디렉토리 += str_num[a] + tCount[a].ToString().PadLeft(4, '0') + tTotal[a].ToString().PadLeft(5, '0');
|
||||
디렉토리 += str_num[a] + tCount[a].ToString().PadLeft(4, '0') + tTotal[a].ToString().PadLeft(5, '0');
|
||||
}
|
||||
|
||||
string[] 리더부 = { "00000","n", "a", "m", " ",
|
||||
@@ -1642,11 +1667,11 @@ namespace WindowsFormsApp1
|
||||
|
||||
string dp = 가변길이 + 디렉토리;
|
||||
int recode = 0;
|
||||
if (EncodingType == "UTF-8") recode = Encoding.UTF8.GetBytes(dp).Length- WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔");
|
||||
if (EncodingType == "UTF-8") recode = Encoding.UTF8.GetBytes(dp).Length - WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔");
|
||||
else if (EncodingType == "UniCode") recode = Encoding.Unicode.GetBytes(dp).Length - WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔");
|
||||
else recode = Encoding.Default.GetBytes(dp).Length- WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔");
|
||||
|
||||
|
||||
else recode = Encoding.Default.GetBytes(dp).Length - WordCheck(dp, "▲") - WordCheck(dp, "▼") - WordCheck(dp, "↔");
|
||||
|
||||
|
||||
리더부[0] = insert_Zero(recode + 24, 5);
|
||||
|
||||
int data_addr = 24 + Encoding.Default.GetBytes(디렉토리).Length - WordCheck(디렉토리, "▲");
|
||||
@@ -1693,7 +1718,7 @@ namespace WindowsFormsApp1
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 추가하고 싶은 태그를 뷰형태의 마크에 추가하는 함수.
|
||||
@@ -1706,7 +1731,7 @@ namespace WindowsFormsApp1
|
||||
if (Tag.Length < 3) return "";
|
||||
|
||||
int TargetTagNum = Convert.ToInt32(Tag.Substring(0, 3));
|
||||
|
||||
|
||||
string[] SplitView = TypeView.Split('\n');
|
||||
List<string> View = new List<string>(SplitView);
|
||||
|
||||
@@ -1731,9 +1756,9 @@ namespace WindowsFormsApp1
|
||||
/// <param name="pAddTag">추가할 태그 (태그명\t지시기호\t태그내용)</param>
|
||||
/// <param name="pTargetData">뷰형태의 마크</param>
|
||||
/// <returns></returns>
|
||||
public string AddTagInMarc(int pTargetTagNum,string pAddTag, string pTargetData)//TagTarget Num 을 찾아서 있을경우는 해당 Tag 데이터를 전송, 없을경우는 신규로 해야함.
|
||||
public string AddTagInMarc(int pTargetTagNum, string pAddTag, string pTargetData)//TagTarget Num 을 찾아서 있을경우는 해당 Tag 데이터를 전송, 없을경우는 신규로 해야함.
|
||||
{
|
||||
|
||||
|
||||
if (pAddTag.Length < 3) return "";
|
||||
string tRet = pTargetData;
|
||||
// ex ) 020 : ~~~ 에 XXXX 내용줄 뒤에 추가
|
||||
@@ -1827,7 +1852,7 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{// 기존 태그 변경
|
||||
int endIdx = SplitView[a].IndexOf("▼", startIdx + 1);
|
||||
@@ -1906,7 +1931,7 @@ namespace WindowsFormsApp1
|
||||
/// <param name="marc">마크 데이터</param>
|
||||
/// <param name="search">추출할 함수(배열)</param>
|
||||
/// <returns></returns>
|
||||
public string[] Take_Tag(string marc, string[] search,bool pSearchTag = false)
|
||||
public string[] Take_Tag(string marc, string[] search, bool pSearchTag = false)
|
||||
{
|
||||
string[] ary = marc.Split('');
|
||||
string[] tag = res_dir(ary[0].Substring(24));
|
||||
@@ -1958,7 +1983,7 @@ namespace WindowsFormsApp1
|
||||
//memo = result[b];
|
||||
start += 2;
|
||||
int end = -1;
|
||||
if (tmp.Length > 1) end=tmp.IndexOf("", start);
|
||||
if (tmp.Length > 1) end = tmp.IndexOf("", start);
|
||||
if (memo == result[b])
|
||||
break;
|
||||
|
||||
@@ -2130,9 +2155,14 @@ namespace WindowsFormsApp1
|
||||
/// </summary>
|
||||
/// <param name="Marc">한줄짜리 마크</param>
|
||||
/// <returns></returns>
|
||||
public string ConvertMarcType(string Marc)
|
||||
public string ConvertMarcType(string Marc, out string errmessage)
|
||||
{
|
||||
if (Marc.Length < 3) return "";
|
||||
errmessage = string.Empty;
|
||||
if (Marc.Length < 3)
|
||||
{
|
||||
errmessage = "MARC 데이터길이가 너무 짧습니다.";
|
||||
return "";
|
||||
}
|
||||
|
||||
string result = "";
|
||||
|
||||
@@ -2140,12 +2170,15 @@ namespace WindowsFormsApp1
|
||||
List<string> Field = new List<string>(); // 가변길이필드 저장용
|
||||
|
||||
Marc = Marc.Replace("", "▼").Replace("", "▲");
|
||||
Marc = Marc.Replace(((char)0x1D).ToString(), "");
|
||||
Marc = Marc.Replace(((char)0x1E).ToString(), "");
|
||||
Marc = Marc.Replace(((char)0x1F).ToString(), "");
|
||||
|
||||
int StartIdx = 0;
|
||||
|
||||
// 리더부를 제외한 디렉토리, 가변길이필드 저장
|
||||
string[] data = Marc.Substring(24).Split('▲');
|
||||
for (int a = 1; a < data.Length - 1; a++)
|
||||
string[] data = Marc.Substring(24).Split(new char[] { '▲' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int a = 1; a < data.Length; a++)
|
||||
{
|
||||
TagNum.Add(data[0].Substring(StartIdx, 3));
|
||||
StartIdx += 12;
|
||||
@@ -2161,10 +2194,32 @@ namespace WindowsFormsApp1
|
||||
else if (res.StartsWith("00")) { res += "\t \t" + Field[a]; }
|
||||
else
|
||||
{
|
||||
string temp = Field[a].Insert(2, "\t");
|
||||
res += "\t" + temp;
|
||||
var fieldValue = Field[a].Trim();
|
||||
bool isEmpty = false;
|
||||
if (fieldValue.IndexOf("▼") != -1)
|
||||
{
|
||||
var dataArea = fieldValue.Substring(fieldValue.IndexOf("▼") + 1);
|
||||
isEmpty = dataArea.ToString().isEmpty();
|
||||
}
|
||||
else
|
||||
{
|
||||
isEmpty = fieldValue.Replace("▲", "").Trim().isEmpty();
|
||||
}
|
||||
if (isEmpty) //no data
|
||||
{
|
||||
errmessage = (errmessage.isEmpty() == false ? "\n" : "") + "태그 " + TagNum[a] + " 에 데이터가 없습니다.";
|
||||
Console.WriteLine("field length error");
|
||||
res = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
string temp = Field[a].Insert(2, "\t");
|
||||
res += "\t" + temp;
|
||||
}
|
||||
|
||||
}
|
||||
result += res + "\n";
|
||||
if (res.isEmpty() == false)
|
||||
result += res + "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -2188,7 +2243,8 @@ namespace WindowsFormsApp1
|
||||
/// <param name="e">EventArgs</param>
|
||||
public void Int_Comma(object sender, EventArgs e)
|
||||
{
|
||||
if (((TextBox)sender).Text != "") {
|
||||
if (((TextBox)sender).Text != "")
|
||||
{
|
||||
string text;
|
||||
text = ((TextBox)sender).Text.Replace(",", "");
|
||||
((TextBox)sender).Text = String.Format("{0:#,###}", Convert.ToInt32(text));
|
||||
@@ -2204,7 +2260,7 @@ namespace WindowsFormsApp1
|
||||
public bool isContainHangul(string value)
|
||||
{
|
||||
char[] charArr = value.ToCharArray();
|
||||
foreach(char c in charArr)
|
||||
foreach (char c in charArr)
|
||||
{
|
||||
if (char.GetUnicodeCategory(c) == System.Globalization.UnicodeCategory.OtherLetter)
|
||||
return true;
|
||||
@@ -2221,7 +2277,7 @@ namespace WindowsFormsApp1
|
||||
public bool CheckString(string value, string chkString)
|
||||
{
|
||||
int index = value.IndexOf(chkString);
|
||||
if (index < 0)
|
||||
if (index < 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -2264,10 +2320,10 @@ namespace WindowsFormsApp1
|
||||
public class API
|
||||
{
|
||||
|
||||
public string CheckString(string pText,string pStr)
|
||||
public string CheckString(string pText, string pStr)
|
||||
{
|
||||
string tRet = pText;
|
||||
Regex reg = new Regex(@"([\"+pStr+"]+)" + @"[가-힣]+");//+ @"([\>]+)");//new Regex(@"([\<]+)"+ @"[ㄱ-ㅎ가-힣]+"+@"([\>]+)");
|
||||
Regex reg = new Regex(@"([\" + pStr + "]+)" + @"[가-힣]+");//+ @"([\>]+)");//new Regex(@"([\<]+)"+ @"[ㄱ-ㅎ가-힣]+"+@"([\>]+)");
|
||||
MatchCollection tMatch = reg.Matches(tRet);
|
||||
for (int i = 0; i < tMatch.Count; i++)
|
||||
{
|
||||
@@ -2326,8 +2382,9 @@ namespace WindowsFormsApp1
|
||||
xml = CheckString(xml, "〈");
|
||||
doc.LoadXml(xml);
|
||||
}
|
||||
catch (Exception ex){
|
||||
return "";
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
var json = JsonConvert.SerializeXmlNode(doc);
|
||||
|
||||
@@ -2520,19 +2577,23 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
if (length == 1)
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
tmp_data.Add(docs[Param[b]]["#text"]);
|
||||
}
|
||||
catch (KeyNotFoundException e) {
|
||||
catch (KeyNotFoundException e)
|
||||
{
|
||||
tmp_data.Add("");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
try {
|
||||
try
|
||||
{
|
||||
tmp_data.Add(docs[a][Param[b]]["#text"]);
|
||||
}
|
||||
catch (KeyNotFoundException e) {
|
||||
catch (KeyNotFoundException e)
|
||||
{
|
||||
tmp_data.Add("");
|
||||
}
|
||||
}
|
||||
@@ -2649,8 +2710,8 @@ namespace WindowsFormsApp1
|
||||
return dialogResult;
|
||||
}
|
||||
}
|
||||
public class PrintLine
|
||||
{
|
||||
public class PrintLine
|
||||
{
|
||||
string num { get; set; }
|
||||
string count { get; set; }
|
||||
string list_name { get; set; }
|
||||
@@ -2963,7 +3024,7 @@ namespace WindowsFormsApp1
|
||||
{
|
||||
string version = "0";
|
||||
var fn = Application.StartupPath + "\\update.inf";
|
||||
if(System.IO.File.Exists(fn))
|
||||
if (System.IO.File.Exists(fn))
|
||||
{
|
||||
StreamReader sr = new StreamReader(fn);
|
||||
while (!sr.EndOfStream)
|
||||
@@ -2976,7 +3037,7 @@ namespace WindowsFormsApp1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,6 +224,7 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Helper_LibraryDelaySettings.cs" />
|
||||
<Compile Include="PUB.cs" />
|
||||
<Compile Include="SearchModel\AnsanLibSearcher.cs" />
|
||||
<Compile Include="SearchModel\BookSearchService.cs" />
|
||||
@@ -236,6 +237,7 @@
|
||||
<Compile Include="SearchModel\DownloadProgressForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SearchModel\GochangLibSearcher.cs" />
|
||||
<Compile Include="SearchModel\GoheungLibSearcher.cs" />
|
||||
<Compile Include="SearchModel\GwangjuCityLibSearcher.cs" />
|
||||
<Compile Include="SearchModel\GwangjuDongguLibSearcher.cs" />
|
||||
@@ -247,6 +249,7 @@
|
||||
<Compile Include="SearchModel\IksanLibSearcher.cs" />
|
||||
<Compile Include="SearchModel\ILibrarySearcher.cs" />
|
||||
<Compile Include="SearchModel\JeonbukEduLibSearcher.cs" />
|
||||
<Compile Include="SearchModel\JeonnamProvLibSearcher.cs" />
|
||||
<Compile Include="SearchModel\KcmLibSearcher.cs" />
|
||||
<Compile Include="SearchModel\MokpoLibSearcher.cs" />
|
||||
<Compile Include="SearchModel\MuanLibSearcher.cs" />
|
||||
@@ -324,6 +327,12 @@
|
||||
<Compile Include="마크\Check_Copy_Login.Designer.cs">
|
||||
<DependentUpon>Check_Copy_Login.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="마크\Check_Copy_Sub_Selector.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="마크\Check_Copy_Sub_Selector.Designer.cs">
|
||||
<DependentUpon>Check_Copy_Sub_Selector.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="마크\Help_007.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -1021,6 +1030,9 @@
|
||||
<EmbeddedResource Include="마크\Check_Copy_Login.resx">
|
||||
<DependentUpon>Check_Copy_Login.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="마크\Check_Copy_Sub_Selector.resx">
|
||||
<DependentUpon>Check_Copy_Sub_Selector.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="마크\Help_007.resx">
|
||||
<DependentUpon>Help_007.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>ko-KR</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<EnableSecurityDebugging>false</EnableSecurityDebugging>
|
||||
|
||||
24
unimarc/unimarc/UniMarc.sln
Normal file
24
unimarc/unimarc/UniMarc.sln
Normal file
@@ -0,0 +1,24 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniMarc", "UniMarc.csproj", "{4FCAFD58-3A8E-4E08-85E2-05329866193A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4FCAFD58-3A8E-4E08-85E2-05329866193A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4FCAFD58-3A8E-4E08-85E2-05329866193A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4FCAFD58-3A8E-4E08-85E2-05329866193A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4FCAFD58-3A8E-4E08-85E2-05329866193A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {FA0A3E60-8B04-4285-947B-DE3CCCCDEB3B}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -33,6 +33,10 @@ namespace UniMarc.개발자용
|
||||
var sql = $"select * from {cmbTables.Text}";
|
||||
var cn = db.CreateConnection();
|
||||
var da = new MySql.Data.MySqlClient.MySqlDataAdapter(sql, cn);
|
||||
var cb = new MySql.Data.MySqlClient.MySqlCommandBuilder(da);
|
||||
da.UpdateCommand = cb.GetUpdateCommand();
|
||||
da.InsertCommand = cb.GetInsertCommand();
|
||||
da.DeleteCommand = cb.GetDeleteCommand();
|
||||
var cnt = da.Update(dt);
|
||||
UTIL.MsgI($"P{cnt}");
|
||||
cn.Dispose();
|
||||
|
||||
201
unimarc/unimarc/마스터/Batch_processing.Designer.cs
generated
201
unimarc/unimarc/마스터/Batch_processing.Designer.cs
generated
@@ -28,26 +28,190 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Batch_processing));
|
||||
this.dv1 = new System.Windows.Forms.DataGridView();
|
||||
this.bs = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.bn = new System.Windows.Forms.BindingNavigator(this.components);
|
||||
this.bindingNavigatorMoveFirstItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.bindingNavigatorMovePreviousItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.bindingNavigatorSeparator = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.bindingNavigatorPositionItem = new System.Windows.Forms.ToolStripTextBox();
|
||||
this.bindingNavigatorCountItem = new System.Windows.Forms.ToolStripLabel();
|
||||
this.bindingNavigatorSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.bindingNavigatorMoveNextItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.bindingNavigatorMoveLastItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.bindingNavigatorSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.bindingNavigatorAddNewItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.bindingNavigatorDeleteItem = new System.Windows.Forms.ToolStripButton();
|
||||
this.btSave = new System.Windows.Forms.ToolStripButton();
|
||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dv1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bs)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bn)).BeginInit();
|
||||
this.bn.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
// dv1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(311, 121);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(119, 12);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "마스터_일괄처리관리";
|
||||
this.dv1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dv1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dv1.Location = new System.Drawing.Point(0, 0);
|
||||
this.dv1.Name = "dv1";
|
||||
this.dv1.RowTemplate.Height = 23;
|
||||
this.dv1.Size = new System.Drawing.Size(866, 559);
|
||||
this.dv1.TabIndex = 0;
|
||||
//
|
||||
// bn
|
||||
//
|
||||
this.bn.AddNewItem = this.bindingNavigatorAddNewItem;
|
||||
this.bn.CountItem = this.bindingNavigatorCountItem;
|
||||
this.bn.DeleteItem = this.bindingNavigatorDeleteItem;
|
||||
this.bn.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.bn.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.bindingNavigatorMoveFirstItem,
|
||||
this.bindingNavigatorMovePreviousItem,
|
||||
this.bindingNavigatorSeparator,
|
||||
this.bindingNavigatorPositionItem,
|
||||
this.bindingNavigatorCountItem,
|
||||
this.bindingNavigatorSeparator1,
|
||||
this.bindingNavigatorMoveNextItem,
|
||||
this.bindingNavigatorMoveLastItem,
|
||||
this.bindingNavigatorSeparator2,
|
||||
this.bindingNavigatorAddNewItem,
|
||||
this.bindingNavigatorDeleteItem,
|
||||
this.btSave,
|
||||
this.toolStripButton1});
|
||||
this.bn.Location = new System.Drawing.Point(0, 559);
|
||||
this.bn.MoveFirstItem = this.bindingNavigatorMoveFirstItem;
|
||||
this.bn.MoveLastItem = this.bindingNavigatorMoveLastItem;
|
||||
this.bn.MoveNextItem = this.bindingNavigatorMoveNextItem;
|
||||
this.bn.MovePreviousItem = this.bindingNavigatorMovePreviousItem;
|
||||
this.bn.Name = "bn";
|
||||
this.bn.PositionItem = this.bindingNavigatorPositionItem;
|
||||
this.bn.Size = new System.Drawing.Size(866, 25);
|
||||
this.bn.TabIndex = 1;
|
||||
this.bn.Text = "bindingNavigator1";
|
||||
//
|
||||
// bindingNavigatorMoveFirstItem
|
||||
//
|
||||
this.bindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.bindingNavigatorMoveFirstItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveFirstItem.Image")));
|
||||
this.bindingNavigatorMoveFirstItem.Name = "bindingNavigatorMoveFirstItem";
|
||||
this.bindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = true;
|
||||
this.bindingNavigatorMoveFirstItem.Size = new System.Drawing.Size(23, 22);
|
||||
this.bindingNavigatorMoveFirstItem.Text = "처음으로 이동";
|
||||
//
|
||||
// bindingNavigatorMovePreviousItem
|
||||
//
|
||||
this.bindingNavigatorMovePreviousItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.bindingNavigatorMovePreviousItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMovePreviousItem.Image")));
|
||||
this.bindingNavigatorMovePreviousItem.Name = "bindingNavigatorMovePreviousItem";
|
||||
this.bindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = true;
|
||||
this.bindingNavigatorMovePreviousItem.Size = new System.Drawing.Size(23, 22);
|
||||
this.bindingNavigatorMovePreviousItem.Text = "이전으로 이동";
|
||||
//
|
||||
// bindingNavigatorSeparator
|
||||
//
|
||||
this.bindingNavigatorSeparator.Name = "bindingNavigatorSeparator";
|
||||
this.bindingNavigatorSeparator.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// bindingNavigatorPositionItem
|
||||
//
|
||||
this.bindingNavigatorPositionItem.AccessibleName = "위치";
|
||||
this.bindingNavigatorPositionItem.AutoSize = false;
|
||||
this.bindingNavigatorPositionItem.Name = "bindingNavigatorPositionItem";
|
||||
this.bindingNavigatorPositionItem.Size = new System.Drawing.Size(50, 23);
|
||||
this.bindingNavigatorPositionItem.Text = "0";
|
||||
this.bindingNavigatorPositionItem.ToolTipText = "현재 위치";
|
||||
//
|
||||
// bindingNavigatorCountItem
|
||||
//
|
||||
this.bindingNavigatorCountItem.Name = "bindingNavigatorCountItem";
|
||||
this.bindingNavigatorCountItem.Size = new System.Drawing.Size(27, 22);
|
||||
this.bindingNavigatorCountItem.Text = "/{0}";
|
||||
this.bindingNavigatorCountItem.ToolTipText = "전체 항목 수";
|
||||
//
|
||||
// bindingNavigatorSeparator1
|
||||
//
|
||||
this.bindingNavigatorSeparator1.Name = "bindingNavigatorSeparator";
|
||||
this.bindingNavigatorSeparator1.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// bindingNavigatorMoveNextItem
|
||||
//
|
||||
this.bindingNavigatorMoveNextItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.bindingNavigatorMoveNextItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveNextItem.Image")));
|
||||
this.bindingNavigatorMoveNextItem.Name = "bindingNavigatorMoveNextItem";
|
||||
this.bindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = true;
|
||||
this.bindingNavigatorMoveNextItem.Size = new System.Drawing.Size(23, 22);
|
||||
this.bindingNavigatorMoveNextItem.Text = "다음으로 이동";
|
||||
//
|
||||
// bindingNavigatorMoveLastItem
|
||||
//
|
||||
this.bindingNavigatorMoveLastItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.bindingNavigatorMoveLastItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorMoveLastItem.Image")));
|
||||
this.bindingNavigatorMoveLastItem.Name = "bindingNavigatorMoveLastItem";
|
||||
this.bindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = true;
|
||||
this.bindingNavigatorMoveLastItem.Size = new System.Drawing.Size(23, 22);
|
||||
this.bindingNavigatorMoveLastItem.Text = "마지막으로 이동";
|
||||
//
|
||||
// bindingNavigatorSeparator2
|
||||
//
|
||||
this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator";
|
||||
this.bindingNavigatorSeparator2.Size = new System.Drawing.Size(6, 25);
|
||||
//
|
||||
// bindingNavigatorAddNewItem
|
||||
//
|
||||
this.bindingNavigatorAddNewItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.bindingNavigatorAddNewItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorAddNewItem.Image")));
|
||||
this.bindingNavigatorAddNewItem.Name = "bindingNavigatorAddNewItem";
|
||||
this.bindingNavigatorAddNewItem.RightToLeftAutoMirrorImage = true;
|
||||
this.bindingNavigatorAddNewItem.Size = new System.Drawing.Size(23, 22);
|
||||
this.bindingNavigatorAddNewItem.Text = "새로 추가";
|
||||
//
|
||||
// bindingNavigatorDeleteItem
|
||||
//
|
||||
this.bindingNavigatorDeleteItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.bindingNavigatorDeleteItem.Image = ((System.Drawing.Image)(resources.GetObject("bindingNavigatorDeleteItem.Image")));
|
||||
this.bindingNavigatorDeleteItem.Name = "bindingNavigatorDeleteItem";
|
||||
this.bindingNavigatorDeleteItem.RightToLeftAutoMirrorImage = true;
|
||||
this.bindingNavigatorDeleteItem.Size = new System.Drawing.Size(23, 22);
|
||||
this.bindingNavigatorDeleteItem.Text = "삭제";
|
||||
//
|
||||
// btSave
|
||||
//
|
||||
this.btSave.Image = ((System.Drawing.Image)(resources.GetObject("btSave.Image")));
|
||||
this.btSave.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.btSave.Name = "btSave";
|
||||
this.btSave.Size = new System.Drawing.Size(52, 22);
|
||||
this.btSave.Text = "Save";
|
||||
this.btSave.Click += new System.EventHandler(this.btSave_Click);
|
||||
//
|
||||
// toolStripButton1
|
||||
//
|
||||
this.toolStripButton1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
|
||||
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
|
||||
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButton1.Name = "toolStripButton1";
|
||||
this.toolStripButton1.Size = new System.Drawing.Size(66, 22);
|
||||
this.toolStripButton1.Text = "Refresh";
|
||||
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
|
||||
//
|
||||
// Batch_processing
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.label1);
|
||||
this.ClientSize = new System.Drawing.Size(866, 584);
|
||||
this.Controls.Add(this.dv1);
|
||||
this.Controls.Add(this.bn);
|
||||
this.Name = "Batch_processing";
|
||||
this.Text = "Batch_processing";
|
||||
this.Load += new System.EventHandler(this.Batch_processing_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dv1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bs)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bn)).EndInit();
|
||||
this.bn.ResumeLayout(false);
|
||||
this.bn.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -55,6 +219,21 @@
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.DataGridView dv1;
|
||||
private System.Windows.Forms.BindingSource bs;
|
||||
private System.Windows.Forms.BindingNavigator bn;
|
||||
private System.Windows.Forms.ToolStripButton bindingNavigatorAddNewItem;
|
||||
private System.Windows.Forms.ToolStripLabel bindingNavigatorCountItem;
|
||||
private System.Windows.Forms.ToolStripButton bindingNavigatorDeleteItem;
|
||||
private System.Windows.Forms.ToolStripButton bindingNavigatorMoveFirstItem;
|
||||
private System.Windows.Forms.ToolStripButton bindingNavigatorMovePreviousItem;
|
||||
private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator;
|
||||
private System.Windows.Forms.ToolStripTextBox bindingNavigatorPositionItem;
|
||||
private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator1;
|
||||
private System.Windows.Forms.ToolStripButton bindingNavigatorMoveNextItem;
|
||||
private System.Windows.Forms.ToolStripButton bindingNavigatorMoveLastItem;
|
||||
private System.Windows.Forms.ToolStripSeparator bindingNavigatorSeparator2;
|
||||
private System.Windows.Forms.ToolStripButton btSave;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton1;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using AR;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
@@ -12,11 +13,83 @@ namespace WindowsFormsApp1.Home
|
||||
{
|
||||
public partial class Batch_processing : Form
|
||||
{
|
||||
Helper_DB db = new Helper_DB();
|
||||
Main main;
|
||||
MySql.Data.MySqlClient.MySqlDataAdapter da;
|
||||
DataTable dt = new DataTable();
|
||||
public Batch_processing(Main _main)
|
||||
{
|
||||
InitializeComponent();
|
||||
main = _main;
|
||||
this.Text = $"매크로 데이터 관리";
|
||||
}
|
||||
|
||||
private void Batch_processing_Load(object sender, EventArgs e)
|
||||
{
|
||||
RefreshData();
|
||||
}
|
||||
void RefreshData()
|
||||
{
|
||||
var sql = "select * from SetMacro order by tag";
|
||||
var firstrun = da == null;
|
||||
if(firstrun)
|
||||
{
|
||||
var cn = db.CreateConnection();
|
||||
|
||||
da = new MySql.Data.MySqlClient.MySqlDataAdapter(sql, cn);
|
||||
var cb = new MySql.Data.MySqlClient.MySqlCommandBuilder(da);
|
||||
|
||||
// CommandBuilder가 Insert/Update/Delete 명령을 자동으로 생성하도록 설정
|
||||
da.InsertCommand = cb.GetInsertCommand();
|
||||
da.UpdateCommand = cb.GetUpdateCommand();
|
||||
da.DeleteCommand = cb.GetDeleteCommand();
|
||||
}
|
||||
|
||||
this.dt.Clear();
|
||||
da.Fill(dt);
|
||||
dt.AcceptChanges();
|
||||
|
||||
if(firstrun)
|
||||
{
|
||||
this.bs.DataSource = dt;
|
||||
this.bn.BindingSource = this.bs;
|
||||
this.dv1.DataSource = this.bs;
|
||||
|
||||
// idx 열(첫번째 열) 편집 비활성화 및 배경색 회색으로 설정
|
||||
if (this.dv1.Columns.Count > 0)
|
||||
{
|
||||
this.dv1.Columns[0].ReadOnly = true;
|
||||
this.dv1.Columns[0].DefaultCellStyle.BackColor = Color.LightGray;
|
||||
this.dv1.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
}
|
||||
|
||||
// 1, 3번 열 가운데 정렬
|
||||
if (this.dv1.Columns.Count > 1)
|
||||
{
|
||||
this.dv1.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
}
|
||||
if (this.dv1.Columns.Count > 3)
|
||||
{
|
||||
this.dv1.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
}
|
||||
}
|
||||
|
||||
this.dv1.AutoResizeColumns();
|
||||
}
|
||||
|
||||
private void btSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Validate();
|
||||
this.bs.EndEdit();
|
||||
if (UTIL.MsgQ("자료를 저장할까요?") != DialogResult.Yes) return;
|
||||
var cnt = da.Update(this.dt);
|
||||
dt.AcceptChanges();
|
||||
UTIL.MsgI($"{cnt}건의 자료가 저장 되었습니다");
|
||||
}
|
||||
|
||||
private void toolStripButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
RefreshData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,4 +117,105 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="bs.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="bn.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>156, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="bindingNavigatorAddNewItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFXSURBVDhPzc9LSwJhFAZgd5FkaAlFRCEhVCRm9TssIiqw
|
||||
7CKWXZCQJA1Lw0JIo1Ckm1SL2rSoTYvaBEUQBhEF4YyXaex3fN/3hrNo4SxkNtELZ3U4D+9Rqf5tCmdV
|
||||
yJ5U4zOlxvuBBuX7ismk1CDfGyDFENIJrXLgbV/zCzzE9MqB57gOpLgOIq7iNtJQGfg4rMFrshbpuA5P
|
||||
u3W4j+pBxBVQwYPrUDMuAy248Btw6m3DkccoB18SWpBiEERcAxH9IMIyiOAGLcyB5h2gOTsYPwrGDyG+
|
||||
2CEHHnfqpbr0ywsiLIEWFkDzTtDcJFjWBsYPg3GDYBkrtmdMcuAu0oibcBOupLqtOPcZQLNjYPwIku52
|
||||
7M13IuoyIeI0IzxlkQPlOfYYpbqMG0DM1VX5oDylPxnXD8ZZseUwKweisybp39IE7T3Kgc3pboQmLAiM
|
||||
98Jv61MO/Fl+ACQj2J5cFZvRAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="bindingNavigatorDeleteItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFrSURBVDhPtZBNKMNhHMf/V+WtlIsLSjkgk5iQTIbkJTKN
|
||||
yLwlBw6LhFx2cCDlQg64SA4kJeVEstO8zWtrSn9pWmkX/OPyfMQQnrWm+Fy/3++n5/kpyl+A6xi6q8Gx
|
||||
w88sJFiZR3SWIyxG2FoPKuHmCpZmvndYW4BeE6LViGgvhbmJgJLXFwpLMdh65JwTh19Sm4kw54K14VtJ
|
||||
DHUgTNkwOSKPv8LiNKIs+U3EcAe4T2Gs3y8d6w8+/oArFzQW+L9UnYGo00NfU2jjD9jbRZj0iIpUqNL9
|
||||
cuxRwZwHWTFoumjudZFQkxmaBM81mHIgPw5fWwWcH74d15sSCcuzwSXceaHZwENhPO6iVHz27c8Bo1ac
|
||||
SRFox/uBJTw/wWAbGBI4SonFt7EqFW9L0lBbKtFurqVMYXcTLTsWZ2IYalc9aI9ySVGUnaQoNKdDzpiy
|
||||
oSaH4zamg3opF97RRrrh7EDOuXDC+AAc2OXwP3kBiiMDHFY5tmwAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="bindingNavigatorMoveFirstItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAExSURBVDhPY2AYNKBw1vP/TQue/8+c+Pg/uhwMhLc/wCnH
|
||||
kDvz2f9VR97/x6UovvvB/+CGa1jlwCBjytP/C/d9wKoovufh/6X7///3r76AIQcHCT1P/k/b8h5DUUT7
|
||||
fbDmzFn//3uVnsBtQGTXo/+9qz+gKAptvQfW3Lru/3//zr//XfIP4DYgsPnh/7r57+CKglvu/l+09///
|
||||
jnX//2fM+fnfru7nf/uM7bgN8Ki6/z9/2hsURXbFt/+nz/n937/r23+dwnf/LRLW4zbAvvTu/+zJrzEU
|
||||
6aec/29S9OK/Stan/8aRy3AbYJF3539q/2usigySTvyXTfv6Xzd4HoYcHBhm3f4f1vISpyL91Mv/NXyn
|
||||
YZUDA520G//9qh/iVaTiMQGnHINT7pX/IAV4FQ1KAADwdsCrWJS2HgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="bindingNavigatorMovePreviousItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAC7SURBVDhPY2AYMiC8/cF/dDGiQXz3g//BDdfIMyC+5+H/
|
||||
pfv///evvkC6ARHt98GaM2f9/+9VeoI0A0Jb74E1t677/9+/8+9/l/wDxBsQ3HL3/6K9//93rPv/P2PO
|
||||
z/92dT//22dsJ94AELArvv0/fc7v//5d3/7rFL77b5GwnjQDQEA/5fx/k6IX/1WyPv03jlxGugEgYJB0
|
||||
4r9s2tf/usHzyDMABPRTL//X8J1GvgEgoOIxgTIDBi8AANAUYJgsLP+3AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="bindingNavigatorMoveNextItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACkSURBVDhPY2AYdKBw1vP/6GIkgdyZz/4ndN8j35CMKU//
|
||||
z9v/+39C1x3yDEnoefJ/9r5f/zu3/v3vVnqZdEMiux79n7Lt1/+SpX//J0z/+98m9yxphgQ2P/zfuvY9
|
||||
WLNxyZf/0tHX/htHLiPeEI+q+/9L5r6Da1Z06SFeMwjYl979H9jyjDzNIGCRd+e/TcEV8jSDgGHWbfI1
|
||||
g4BO2g3yNQ9NAACgfl+gY6ualwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="bindingNavigatorMoveLastItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAErSURBVDhPY2AYVKBw1vP/6GIwAJJrWvD8f+bExzjVMOTO
|
||||
fPY/ofseVgUguVVH3v8Pb3+AVR4MMqY8/T9v/+//CV13MBSB5Bbu+/A/uOEahhwcJPQ8+T9736//nVv/
|
||||
/ncrvYyiECQ3bcv7//7VF3AbENn16P+Ubb/+lyz9+z9h+t//Nrln4YpBcr2rP/z3Kj2B24DA5of/W9e+
|
||||
B2s2LvnyXzr62n/jyGVgDSC5uvnv/rvkH8BtgEfV/f8lc9/BNSu69MAVg+Typ735b5+xHbcB9qV3/we2
|
||||
PMPQDJPLnvz6v0XCetwGWOTd+W9TcAVDM0wutf813EtYgWHWbayaQQAkF9by8r9u8Dys8mCgk3YDpyRI
|
||||
zq/64X8N32k41eAFTrlX/qt4TABjdLmBBQC+0b+zZl1WGAAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="btSave.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIFSURBVDhPpZLtS1NhGMbPPxJmmlYSgqHiKzGU1EDxg4iK
|
||||
YKyG2WBogqMYJQOtCEVRFBGdTBCJfRnkS4VaaWNT5sqx1BUxRXxDHYxAJLvkusEeBaPAB+5z4Jzn+t3X
|
||||
/aLhnEfjo8m+dCoa+7/C3O2Hqe0zDC+8KG+cRZHZhdzaaWTVTCLDMIY0vfM04Nfh77/G/sEhwpEDbO3t
|
||||
I7TxE8urEVy99fT/AL5gWDLrTB/hnF4XsW0khCu5ln8DmJliT2AXrcNBsU1gj/MH4nMeKwBrPktM28xM
|
||||
cX79DFKrHHD5d9D26hvicx4pABt2lpg10zYzU0zr7+e3xXGcrkEB2O2TNec9nJFwB3alZn5jZorfeDZh
|
||||
6Q3g8s06BeCoKF4MRURoH1+BY2oNCbeb0TIclIYxOhzf8frTOuo7FxCbbVIAzpni0iceEc8vhzEwGkJD
|
||||
lx83ymxifejdKjRNk/8PWnyIyTQqAJek0jqHwfEVscu31baIu8+90sTE4nY025dQ2/5FIPpnXlzKuK8A
|
||||
HBUzHot52djqQ6HZhfR7IwK4mKpHtvEDMqvfCiQ6zaAAXM8x94aIWTNrLLG4kVUzgaTSPlzLtyJOZxbb
|
||||
1wtfyg4Q+AfA3aZlButjSfxGcUJBk4g5tuP3haQKRKXcUQDOmbvNTpPOJeFFjordZmbWTNvMTHFUcpUC
|
||||
nOccAdABIDXXE1nzAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIFSURBVDhPpZLtS1NhGMbPPxJmmlYSgqHiKzGU1EDxg4iK
|
||||
YKyG2WBogqMYJQOtCEVRFBGdTBCJfRnkS4VaaWNT5sqx1BUxRXxDHYxAJLvkusEeBaPAB+5z4Jzn+t3X
|
||||
/aLhnEfjo8m+dCoa+7/C3O2Hqe0zDC+8KG+cRZHZhdzaaWTVTCLDMIY0vfM04Nfh77/G/sEhwpEDbO3t
|
||||
I7TxE8urEVy99fT/AL5gWDLrTB/hnF4XsW0khCu5ln8DmJliT2AXrcNBsU1gj/MH4nMeKwBrPktM28xM
|
||||
cX79DFKrHHD5d9D26hvicx4pABt2lpg10zYzU0zr7+e3xXGcrkEB2O2TNec9nJFwB3alZn5jZorfeDZh
|
||||
6Q3g8s06BeCoKF4MRURoH1+BY2oNCbeb0TIclIYxOhzf8frTOuo7FxCbbVIAzpni0iceEc8vhzEwGkJD
|
||||
lx83ymxifejdKjRNk/8PWnyIyTQqAJek0jqHwfEVscu31baIu8+90sTE4nY025dQ2/5FIPpnXlzKuK8A
|
||||
HBUzHot52djqQ6HZhfR7IwK4mKpHtvEDMqvfCiQ6zaAAXM8x94aIWTNrLLG4kVUzgaTSPlzLtyJOZxbb
|
||||
1wtfyg4Q+AfA3aZlButjSfxGcUJBk4g5tuP3haQKRKXcUQDOmbvNTpPOJeFFjordZmbWTNvMTHFUcpUC
|
||||
nOccAdABIDXXE1nzAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -255,7 +255,7 @@ namespace UniMarc.마크
|
||||
|
||||
String_Text st = new String_Text();
|
||||
|
||||
string ViewMarc = st.ConvertMarcType(SelectMarc);
|
||||
string ViewMarc = st.ConvertMarcType(SelectMarc,out string errmesage);
|
||||
List<string> Tmp = new List<string>(ViewMarc.Split('\n'));
|
||||
for (int a = 0; a < Tmp.Count; a++)
|
||||
{
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace UniMarc.마크
|
||||
else
|
||||
return;
|
||||
|
||||
richTextBox1.Text = st.ConvertMarcType(dataGridView1.Rows[row].Cells["Marc"].Value.ToString());
|
||||
richTextBox1.Text = st.ConvertMarcType(dataGridView1.Rows[row].Cells["Marc"].Value.ToString(),out string errmesage);
|
||||
}
|
||||
|
||||
private void Btn_Excel_Click(object sender, EventArgs e)
|
||||
|
||||
149
unimarc/unimarc/마크/Check_Copy_Sub_Selector.Designer.cs
generated
Normal file
149
unimarc/unimarc/마크/Check_Copy_Sub_Selector.Designer.cs
generated
Normal file
@@ -0,0 +1,149 @@
|
||||
|
||||
namespace UniMarc.마크
|
||||
{
|
||||
partial class Check_Copy_Sub_Selector
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.dv1 = new System.Windows.Forms.DataGridView();
|
||||
this.lib_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.tbSearch = new System.Windows.Forms.TextBox();
|
||||
this.btFind = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dv1)).BeginInit();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dv1
|
||||
//
|
||||
this.dv1.AllowUserToAddRows = false;
|
||||
this.dv1.AllowUserToDeleteRows = false;
|
||||
this.dv1.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
|
||||
this.dv1.BackgroundColor = System.Drawing.SystemColors.Control;
|
||||
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.dv1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dv1.ColumnHeadersHeight = 35;
|
||||
this.dv1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
|
||||
this.dv1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.lib_name});
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Window;
|
||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("굴림", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle2.Padding = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dv1.DefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.dv1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dv1.Location = new System.Drawing.Point(0, 0);
|
||||
this.dv1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.dv1.Name = "dv1";
|
||||
this.dv1.ReadOnly = true;
|
||||
this.dv1.RowHeadersWidth = 51;
|
||||
this.dv1.RowTemplate.Height = 23;
|
||||
this.dv1.Size = new System.Drawing.Size(631, 823);
|
||||
this.dv1.TabIndex = 0;
|
||||
this.dv1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);
|
||||
this.dv1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint);
|
||||
this.dv1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView1_KeyDown);
|
||||
//
|
||||
// lib_name
|
||||
//
|
||||
this.lib_name.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
|
||||
this.lib_name.HeaderText = "도서관명";
|
||||
this.lib_name.MinimumWidth = 6;
|
||||
this.lib_name.Name = "lib_name";
|
||||
this.lib_name.ReadOnly = true;
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.tbSearch);
|
||||
this.panel1.Controls.Add(this.btFind);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 823);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.panel1.Size = new System.Drawing.Size(631, 45);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// tbSearch
|
||||
//
|
||||
this.tbSearch.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tbSearch.Font = new System.Drawing.Font("굴림", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(129)));
|
||||
this.tbSearch.Location = new System.Drawing.Point(3, 3);
|
||||
this.tbSearch.Name = "tbSearch";
|
||||
this.tbSearch.Size = new System.Drawing.Size(498, 38);
|
||||
this.tbSearch.TabIndex = 0;
|
||||
this.tbSearch.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// btFind
|
||||
//
|
||||
this.btFind.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.btFind.Location = new System.Drawing.Point(501, 3);
|
||||
this.btFind.Name = "btFind";
|
||||
this.btFind.Size = new System.Drawing.Size(127, 39);
|
||||
this.btFind.TabIndex = 1;
|
||||
this.btFind.Text = "검색";
|
||||
this.btFind.UseVisualStyleBackColor = true;
|
||||
this.btFind.Click += new System.EventHandler(this.btFind_Click);
|
||||
//
|
||||
// Check_Copy_Sub_Selector
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(631, 868);
|
||||
this.Controls.Add(this.dv1);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "Check_Copy_Sub_Selector";
|
||||
this.Text = "도서관 검색";
|
||||
this.Load += new System.EventHandler(this.Check_Copy_Sub_Selector_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dv1)).EndInit();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DataGridView dv1;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Button btFind;
|
||||
private System.Windows.Forms.TextBox tbSearch;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn lib_name;
|
||||
}
|
||||
}
|
||||
109
unimarc/unimarc/마크/Check_Copy_Sub_Selector.cs
Normal file
109
unimarc/unimarc/마크/Check_Copy_Sub_Selector.cs
Normal file
@@ -0,0 +1,109 @@
|
||||
using AR;
|
||||
using Org.BouncyCastle.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.VisualStyles;
|
||||
using WindowsFormsApp1;
|
||||
using WindowsFormsApp1.Mac;
|
||||
|
||||
namespace UniMarc.마크
|
||||
{
|
||||
public partial class Check_Copy_Sub_Selector : Form
|
||||
{
|
||||
string[] Items;
|
||||
public string SelectedValue = string.Empty;
|
||||
public Check_Copy_Sub_Selector(string[] arrays, string search)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.KeyPreview = true;
|
||||
tbSearch.Text = search;
|
||||
this.Items = arrays;
|
||||
this.KeyDown += (s1, e1) => {
|
||||
if (e1.KeyCode == Keys.Escape) this.Close();
|
||||
};
|
||||
this.tbSearch.ImeMode = ImeMode.Hangul;
|
||||
this.tbSearch.KeyDown += (s1, e1) => {
|
||||
if (e1.KeyCode == Keys.Enter) btFind.PerformClick();
|
||||
};
|
||||
}
|
||||
|
||||
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
||||
{
|
||||
Skill_Grid sg = new Skill_Grid();
|
||||
sg.Print_Grid_Num(sender, e);
|
||||
}
|
||||
|
||||
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex < 0) return;
|
||||
int row = e.RowIndex;
|
||||
|
||||
SetCode(e.RowIndex);
|
||||
this.Close();
|
||||
}
|
||||
|
||||
void SetCode(int rowindex)
|
||||
{
|
||||
var drow = dv1.Rows[rowindex];
|
||||
var title = drow.Cells[0].Value?.ToString() ?? string.Empty;
|
||||
this.SelectedValue = title;
|
||||
}
|
||||
|
||||
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
if (dv1.Rows.Count <= 0) return;
|
||||
SetCode(dv1.CurrentRow.Index);
|
||||
this.Close();
|
||||
}
|
||||
if (e.KeyCode == Keys.Escape)
|
||||
{
|
||||
SelectedValue = string.Empty;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void btFind_Click(object sender, EventArgs e)
|
||||
{
|
||||
var search = tbSearch.Text.Trim();
|
||||
this.dv1.Rows.Clear();
|
||||
foreach (var item in this.Items)
|
||||
{
|
||||
if (search.isEmpty() || item.ToLower().Contains(search.ToLower()))
|
||||
this.dv1.Rows.Add(item);
|
||||
}
|
||||
if (search.isEmpty() == true)
|
||||
{
|
||||
tbSearch.Focus();
|
||||
tbSearch.SelectAll();
|
||||
}
|
||||
else if (dv1.Rows.Count > 0)
|
||||
{
|
||||
dv1.Focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
tbSearch.Focus();
|
||||
tbSearch.SelectAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Check_Copy_Sub_Selector_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.Show();
|
||||
Application.DoEvents();
|
||||
this.btFind.PerformClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,10 +117,7 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="file_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="update_status.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="lib_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
||||
247
unimarc/unimarc/마크/Check_copyWD.Designer.cs
generated
247
unimarc/unimarc/마크/Check_copyWD.Designer.cs
generated
@@ -28,8 +28,11 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.nudAddDelay = new System.Windows.Forms.NumericUpDown();
|
||||
this.chkShowBrowser = new System.Windows.Forms.CheckBox();
|
||||
this.chkRetryErrData = new System.Windows.Forms.CheckBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
@@ -44,7 +47,7 @@
|
||||
this.btn_Stop = new System.Windows.Forms.Button();
|
||||
this.btn_Close = new System.Windows.Forms.Button();
|
||||
this.tb_SearchTarget = new System.Windows.Forms.ComboBox();
|
||||
this.btSearchLibrary = new System.Windows.Forms.Label();
|
||||
this.btSearchLibrary = new System.Windows.Forms.Button();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.btn_SiteDenote = new System.Windows.Forms.Button();
|
||||
this.lbl_PW = new System.Windows.Forms.Label();
|
||||
@@ -54,6 +57,10 @@
|
||||
this.book_comp = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dvc_remark = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dvc_resulthtml = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.유니코드문자로붙여넝ㅎ기ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.일반문자로붙여넣기ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.btn_ApplyFilter = new System.Windows.Forms.Button();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel6 = new System.Windows.Forms.Panel();
|
||||
@@ -67,9 +74,11 @@
|
||||
this.btn_OpenMemo = new System.Windows.Forms.Button();
|
||||
this.chk_spChar = new System.Windows.Forms.CheckBox();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudAddDelay)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dv1)).BeginInit();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
this.panel6.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
@@ -79,6 +88,8 @@
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel1.Controls.Add(this.label1);
|
||||
this.panel1.Controls.Add(this.nudAddDelay);
|
||||
this.panel1.Controls.Add(this.chkShowBrowser);
|
||||
this.panel1.Controls.Add(this.chkRetryErrData);
|
||||
this.panel1.Controls.Add(this.groupBox1);
|
||||
@@ -88,19 +99,39 @@
|
||||
this.panel1.Controls.Add(this.btn_Start);
|
||||
this.panel1.Controls.Add(this.btn_Stop);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 34);
|
||||
this.panel1.Location = new System.Drawing.Point(0, 42);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(637, 106);
|
||||
this.panel1.Size = new System.Drawing.Size(822, 132);
|
||||
this.panel1.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(639, 104);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(67, 15);
|
||||
this.label1.TabIndex = 10;
|
||||
this.label1.Text = "추가지연";
|
||||
//
|
||||
// nudAddDelay
|
||||
//
|
||||
this.nudAddDelay.Location = new System.Drawing.Point(706, 99);
|
||||
this.nudAddDelay.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.nudAddDelay.Name = "nudAddDelay";
|
||||
this.nudAddDelay.Size = new System.Drawing.Size(64, 25);
|
||||
this.nudAddDelay.TabIndex = 9;
|
||||
this.nudAddDelay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// chkShowBrowser
|
||||
//
|
||||
this.chkShowBrowser.AutoSize = true;
|
||||
this.chkShowBrowser.Checked = true;
|
||||
this.chkShowBrowser.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.chkShowBrowser.Location = new System.Drawing.Point(515, 81);
|
||||
this.chkShowBrowser.Location = new System.Drawing.Point(706, 62);
|
||||
this.chkShowBrowser.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.chkShowBrowser.Name = "chkShowBrowser";
|
||||
this.chkShowBrowser.Size = new System.Drawing.Size(96, 16);
|
||||
this.chkShowBrowser.Size = new System.Drawing.Size(119, 19);
|
||||
this.chkShowBrowser.TabIndex = 8;
|
||||
this.chkShowBrowser.Text = "브라우저표시";
|
||||
this.chkShowBrowser.UseVisualStyleBackColor = true;
|
||||
@@ -110,9 +141,10 @@
|
||||
this.chkRetryErrData.AutoSize = true;
|
||||
this.chkRetryErrData.Checked = true;
|
||||
this.chkRetryErrData.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.chkRetryErrData.Location = new System.Drawing.Point(319, 81);
|
||||
this.chkRetryErrData.Location = new System.Drawing.Point(365, 101);
|
||||
this.chkRetryErrData.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.chkRetryErrData.Name = "chkRetryErrData";
|
||||
this.chkRetryErrData.Size = new System.Drawing.Size(188, 16);
|
||||
this.chkRetryErrData.Size = new System.Drawing.Size(234, 19);
|
||||
this.chkRetryErrData.TabIndex = 7;
|
||||
this.chkRetryErrData.Text = "검색 후 오류 데이터 추가 검색";
|
||||
this.chkRetryErrData.UseVisualStyleBackColor = true;
|
||||
@@ -123,9 +155,11 @@
|
||||
this.groupBox1.Controls.Add(this.radTargetEmpty);
|
||||
this.groupBox1.Controls.Add(this.radTargetErrEmpty);
|
||||
this.groupBox1.Controls.Add(this.radTargetAll);
|
||||
this.groupBox1.Location = new System.Drawing.Point(318, 34);
|
||||
this.groupBox1.Location = new System.Drawing.Point(363, 42);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(304, 39);
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.groupBox1.Size = new System.Drawing.Size(336, 49);
|
||||
this.groupBox1.TabIndex = 6;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "검색대상";
|
||||
@@ -133,9 +167,10 @@
|
||||
// radTargetErr
|
||||
//
|
||||
this.radTargetErr.AutoSize = true;
|
||||
this.radTargetErr.Location = new System.Drawing.Point(197, 16);
|
||||
this.radTargetErr.Location = new System.Drawing.Point(273, 20);
|
||||
this.radTargetErr.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.radTargetErr.Name = "radTargetErr";
|
||||
this.radTargetErr.Size = new System.Drawing.Size(47, 16);
|
||||
this.radTargetErr.Size = new System.Drawing.Size(58, 19);
|
||||
this.radTargetErr.TabIndex = 9;
|
||||
this.radTargetErr.Text = "오류";
|
||||
this.radTargetErr.UseVisualStyleBackColor = true;
|
||||
@@ -143,9 +178,10 @@
|
||||
// radTargetEmpty
|
||||
//
|
||||
this.radTargetEmpty.AutoSize = true;
|
||||
this.radTargetEmpty.Location = new System.Drawing.Point(144, 16);
|
||||
this.radTargetEmpty.Location = new System.Drawing.Point(197, 20);
|
||||
this.radTargetEmpty.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.radTargetEmpty.Name = "radTargetEmpty";
|
||||
this.radTargetEmpty.Size = new System.Drawing.Size(47, 16);
|
||||
this.radTargetEmpty.Size = new System.Drawing.Size(58, 19);
|
||||
this.radTargetEmpty.TabIndex = 8;
|
||||
this.radTargetEmpty.Text = "없음";
|
||||
this.radTargetEmpty.UseVisualStyleBackColor = true;
|
||||
@@ -153,9 +189,10 @@
|
||||
// radTargetErrEmpty
|
||||
//
|
||||
this.radTargetErrEmpty.AutoSize = true;
|
||||
this.radTargetErrEmpty.Location = new System.Drawing.Point(61, 17);
|
||||
this.radTargetErrEmpty.Location = new System.Drawing.Point(86, 20);
|
||||
this.radTargetErrEmpty.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.radTargetErrEmpty.Name = "radTargetErrEmpty";
|
||||
this.radTargetErrEmpty.Size = new System.Drawing.Size(77, 16);
|
||||
this.radTargetErrEmpty.Size = new System.Drawing.Size(96, 19);
|
||||
this.radTargetErrEmpty.TabIndex = 7;
|
||||
this.radTargetErrEmpty.Text = "오류+없음";
|
||||
this.radTargetErrEmpty.UseVisualStyleBackColor = true;
|
||||
@@ -164,9 +201,10 @@
|
||||
//
|
||||
this.radTargetAll.AutoSize = true;
|
||||
this.radTargetAll.Checked = true;
|
||||
this.radTargetAll.Location = new System.Drawing.Point(8, 16);
|
||||
this.radTargetAll.Location = new System.Drawing.Point(9, 20);
|
||||
this.radTargetAll.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.radTargetAll.Name = "radTargetAll";
|
||||
this.radTargetAll.Size = new System.Drawing.Size(47, 16);
|
||||
this.radTargetAll.Size = new System.Drawing.Size(58, 19);
|
||||
this.radTargetAll.TabIndex = 6;
|
||||
this.radTargetAll.TabStop = true;
|
||||
this.radTargetAll.Text = "전체";
|
||||
@@ -175,9 +213,10 @@
|
||||
// rb_isNumber
|
||||
//
|
||||
this.rb_isNumber.AutoSize = true;
|
||||
this.rb_isNumber.Location = new System.Drawing.Point(394, 8);
|
||||
this.rb_isNumber.Location = new System.Drawing.Point(450, 10);
|
||||
this.rb_isNumber.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.rb_isNumber.Name = "rb_isNumber";
|
||||
this.rb_isNumber.Size = new System.Drawing.Size(71, 16);
|
||||
this.rb_isNumber.Size = new System.Drawing.Size(88, 19);
|
||||
this.rb_isNumber.TabIndex = 5;
|
||||
this.rb_isNumber.TabStop = true;
|
||||
this.rb_isNumber.Text = "숫자표출";
|
||||
@@ -187,9 +226,10 @@
|
||||
//
|
||||
this.rb_isHave.AutoSize = true;
|
||||
this.rb_isHave.Checked = true;
|
||||
this.rb_isHave.Location = new System.Drawing.Point(318, 8);
|
||||
this.rb_isHave.Location = new System.Drawing.Point(363, 10);
|
||||
this.rb_isHave.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.rb_isHave.Name = "rb_isHave";
|
||||
this.rb_isHave.Size = new System.Drawing.Size(71, 16);
|
||||
this.rb_isHave.Size = new System.Drawing.Size(88, 19);
|
||||
this.rb_isHave.TabIndex = 5;
|
||||
this.rb_isHave.TabStop = true;
|
||||
this.rb_isHave.Text = "소장표출";
|
||||
@@ -197,9 +237,10 @@
|
||||
//
|
||||
// btn_SearchList
|
||||
//
|
||||
this.btn_SearchList.Location = new System.Drawing.Point(4, 4);
|
||||
this.btn_SearchList.Location = new System.Drawing.Point(5, 5);
|
||||
this.btn_SearchList.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_SearchList.Name = "btn_SearchList";
|
||||
this.btn_SearchList.Size = new System.Drawing.Size(305, 93);
|
||||
this.btn_SearchList.Size = new System.Drawing.Size(349, 116);
|
||||
this.btn_SearchList.TabIndex = 3;
|
||||
this.btn_SearchList.Text = "목록 검색";
|
||||
this.btn_SearchList.UseVisualStyleBackColor = true;
|
||||
@@ -207,9 +248,10 @@
|
||||
//
|
||||
// btn_Start
|
||||
//
|
||||
this.btn_Start.Location = new System.Drawing.Point(470, 4);
|
||||
this.btn_Start.Location = new System.Drawing.Point(537, 5);
|
||||
this.btn_Start.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_Start.Name = "btn_Start";
|
||||
this.btn_Start.Size = new System.Drawing.Size(75, 24);
|
||||
this.btn_Start.Size = new System.Drawing.Size(175, 30);
|
||||
this.btn_Start.TabIndex = 2;
|
||||
this.btn_Start.Text = "검색시작";
|
||||
this.btn_Start.UseVisualStyleBackColor = true;
|
||||
@@ -217,9 +259,10 @@
|
||||
//
|
||||
// btn_Stop
|
||||
//
|
||||
this.btn_Stop.Location = new System.Drawing.Point(548, 4);
|
||||
this.btn_Stop.Location = new System.Drawing.Point(721, 5);
|
||||
this.btn_Stop.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_Stop.Name = "btn_Stop";
|
||||
this.btn_Stop.Size = new System.Drawing.Size(75, 24);
|
||||
this.btn_Stop.Size = new System.Drawing.Size(86, 30);
|
||||
this.btn_Stop.TabIndex = 2;
|
||||
this.btn_Stop.Text = "검색중지";
|
||||
this.btn_Stop.UseVisualStyleBackColor = true;
|
||||
@@ -227,9 +270,10 @@
|
||||
//
|
||||
// btn_Close
|
||||
//
|
||||
this.btn_Close.Location = new System.Drawing.Point(548, 4);
|
||||
this.btn_Close.Location = new System.Drawing.Point(721, 5);
|
||||
this.btn_Close.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_Close.Name = "btn_Close";
|
||||
this.btn_Close.Size = new System.Drawing.Size(75, 24);
|
||||
this.btn_Close.Size = new System.Drawing.Size(86, 30);
|
||||
this.btn_Close.TabIndex = 2;
|
||||
this.btn_Close.Text = "닫 기";
|
||||
this.btn_Close.UseVisualStyleBackColor = true;
|
||||
@@ -237,13 +281,14 @@
|
||||
//
|
||||
// tb_SearchTarget
|
||||
//
|
||||
this.tb_SearchTarget.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
|
||||
this.tb_SearchTarget.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
|
||||
this.tb_SearchTarget.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||
this.tb_SearchTarget.Enabled = false;
|
||||
this.tb_SearchTarget.ImeMode = System.Windows.Forms.ImeMode.Hangul;
|
||||
this.tb_SearchTarget.Location = new System.Drawing.Point(66, 6);
|
||||
this.tb_SearchTarget.Location = new System.Drawing.Point(91, 8);
|
||||
this.tb_SearchTarget.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.tb_SearchTarget.Name = "tb_SearchTarget";
|
||||
this.tb_SearchTarget.Size = new System.Drawing.Size(390, 20);
|
||||
this.tb_SearchTarget.Size = new System.Drawing.Size(429, 23);
|
||||
this.tb_SearchTarget.TabIndex = 1;
|
||||
this.tb_SearchTarget.SelectedIndexChanged += new System.EventHandler(this.tb_SearchTarget_SelectedIndexChanged);
|
||||
this.tb_SearchTarget.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_SearchTarget_KeyDown);
|
||||
@@ -251,9 +296,9 @@
|
||||
// btSearchLibrary
|
||||
//
|
||||
this.btSearchLibrary.AutoSize = true;
|
||||
this.btSearchLibrary.Location = new System.Drawing.Point(7, 10);
|
||||
this.btSearchLibrary.Location = new System.Drawing.Point(8, 7);
|
||||
this.btSearchLibrary.Name = "btSearchLibrary";
|
||||
this.btSearchLibrary.Size = new System.Drawing.Size(53, 12);
|
||||
this.btSearchLibrary.Size = new System.Drawing.Size(77, 25);
|
||||
this.btSearchLibrary.TabIndex = 0;
|
||||
this.btSearchLibrary.Text = "검색대상";
|
||||
this.btSearchLibrary.Click += new System.EventHandler(this.btSearchLibrary_Click);
|
||||
@@ -269,15 +314,17 @@
|
||||
this.panel2.Controls.Add(this.btn_Close);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(637, 34);
|
||||
this.panel2.Size = new System.Drawing.Size(822, 42);
|
||||
this.panel2.TabIndex = 0;
|
||||
//
|
||||
// btn_SiteDenote
|
||||
//
|
||||
this.btn_SiteDenote.Location = new System.Drawing.Point(462, 5);
|
||||
this.btn_SiteDenote.Location = new System.Drawing.Point(537, 6);
|
||||
this.btn_SiteDenote.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_SiteDenote.Name = "btn_SiteDenote";
|
||||
this.btn_SiteDenote.Size = new System.Drawing.Size(77, 23);
|
||||
this.btn_SiteDenote.Size = new System.Drawing.Size(177, 29);
|
||||
this.btn_SiteDenote.TabIndex = 4;
|
||||
this.btn_SiteDenote.Text = "사이트 표출";
|
||||
this.btn_SiteDenote.UseVisualStyleBackColor = true;
|
||||
@@ -286,18 +333,18 @@
|
||||
// lbl_PW
|
||||
//
|
||||
this.lbl_PW.AutoSize = true;
|
||||
this.lbl_PW.Location = new System.Drawing.Point(379, 10);
|
||||
this.lbl_PW.Location = new System.Drawing.Point(433, 12);
|
||||
this.lbl_PW.Name = "lbl_PW";
|
||||
this.lbl_PW.Size = new System.Drawing.Size(9, 12);
|
||||
this.lbl_PW.Size = new System.Drawing.Size(12, 15);
|
||||
this.lbl_PW.TabIndex = 3;
|
||||
this.lbl_PW.Text = " ";
|
||||
//
|
||||
// lbl_ID
|
||||
//
|
||||
this.lbl_ID.AutoSize = true;
|
||||
this.lbl_ID.Location = new System.Drawing.Point(316, 10);
|
||||
this.lbl_ID.Location = new System.Drawing.Point(361, 12);
|
||||
this.lbl_ID.Name = "lbl_ID";
|
||||
this.lbl_ID.Size = new System.Drawing.Size(9, 12);
|
||||
this.lbl_ID.Size = new System.Drawing.Size(12, 15);
|
||||
this.lbl_ID.TabIndex = 3;
|
||||
this.lbl_ID.Text = " ";
|
||||
//
|
||||
@@ -320,12 +367,16 @@
|
||||
this.book_name,
|
||||
this.book_comp,
|
||||
this.Count,
|
||||
this.dvc_remark});
|
||||
this.dvc_remark,
|
||||
this.dvc_resulthtml});
|
||||
this.dv1.ContextMenuStrip = this.contextMenuStrip1;
|
||||
this.dv1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dv1.Location = new System.Drawing.Point(0, 0);
|
||||
this.dv1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.dv1.Name = "dv1";
|
||||
this.dv1.RowHeadersWidth = 51;
|
||||
this.dv1.RowTemplate.Height = 23;
|
||||
this.dv1.Size = new System.Drawing.Size(637, 542);
|
||||
this.dv1.Size = new System.Drawing.Size(822, 680);
|
||||
this.dv1.TabIndex = 1;
|
||||
this.dv1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint);
|
||||
this.dv1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView1_KeyDown);
|
||||
@@ -333,6 +384,7 @@
|
||||
// book_name
|
||||
//
|
||||
this.book_name.HeaderText = "도서명(총서명)";
|
||||
this.book_name.MinimumWidth = 6;
|
||||
this.book_name.Name = "book_name";
|
||||
this.book_name.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.book_name.Width = 300;
|
||||
@@ -340,6 +392,7 @@
|
||||
// book_comp
|
||||
//
|
||||
this.book_comp.HeaderText = "출판사";
|
||||
this.book_comp.MinimumWidth = 6;
|
||||
this.book_comp.Name = "book_comp";
|
||||
this.book_comp.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.book_comp.Width = 120;
|
||||
@@ -347,6 +400,7 @@
|
||||
// Count
|
||||
//
|
||||
this.Count.HeaderText = "검색 수";
|
||||
this.Count.MinimumWidth = 6;
|
||||
this.Count.Name = "Count";
|
||||
this.Count.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
|
||||
this.Count.Width = 50;
|
||||
@@ -354,14 +408,46 @@
|
||||
// dvc_remark
|
||||
//
|
||||
this.dvc_remark.HeaderText = "비고";
|
||||
this.dvc_remark.MinimumWidth = 6;
|
||||
this.dvc_remark.Name = "dvc_remark";
|
||||
this.dvc_remark.Width = 110;
|
||||
//
|
||||
// dvc_resulthtml
|
||||
//
|
||||
this.dvc_resulthtml.HeaderText = "결과";
|
||||
this.dvc_resulthtml.MinimumWidth = 6;
|
||||
this.dvc_resulthtml.Name = "dvc_resulthtml";
|
||||
this.dvc_resulthtml.Width = 125;
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.유니코드문자로붙여넝ㅎ기ToolStripMenuItem,
|
||||
this.일반문자로붙여넣기ToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(254, 52);
|
||||
//
|
||||
// 유니코드문자로붙여넝ㅎ기ToolStripMenuItem
|
||||
//
|
||||
this.유니코드문자로붙여넝ㅎ기ToolStripMenuItem.Name = "유니코드문자로붙여넝ㅎ기ToolStripMenuItem";
|
||||
this.유니코드문자로붙여넝ㅎ기ToolStripMenuItem.Size = new System.Drawing.Size(253, 24);
|
||||
this.유니코드문자로붙여넝ㅎ기ToolStripMenuItem.Text = "유니코드 문자로 붙여넣기";
|
||||
this.유니코드문자로붙여넝ㅎ기ToolStripMenuItem.Click += new System.EventHandler(this.유니코드문자로붙여넝ㅎ기ToolStripMenuItem_Click);
|
||||
//
|
||||
// 일반문자로붙여넣기ToolStripMenuItem
|
||||
//
|
||||
this.일반문자로붙여넣기ToolStripMenuItem.Name = "일반문자로붙여넣기ToolStripMenuItem";
|
||||
this.일반문자로붙여넣기ToolStripMenuItem.Size = new System.Drawing.Size(253, 24);
|
||||
this.일반문자로붙여넣기ToolStripMenuItem.Text = "일반 문자로 붙여넣기";
|
||||
this.일반문자로붙여넣기ToolStripMenuItem.Click += new System.EventHandler(this.일반문자로붙여넣기ToolStripMenuItem_Click);
|
||||
//
|
||||
// btn_ApplyFilter
|
||||
//
|
||||
this.btn_ApplyFilter.Location = new System.Drawing.Point(317, 4);
|
||||
this.btn_ApplyFilter.Location = new System.Drawing.Point(362, 5);
|
||||
this.btn_ApplyFilter.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_ApplyFilter.Name = "btn_ApplyFilter";
|
||||
this.btn_ApplyFilter.Size = new System.Drawing.Size(75, 24);
|
||||
this.btn_ApplyFilter.Size = new System.Drawing.Size(86, 30);
|
||||
this.btn_ApplyFilter.TabIndex = 2;
|
||||
this.btn_ApplyFilter.Text = "필터적용";
|
||||
this.btn_ApplyFilter.UseVisualStyleBackColor = true;
|
||||
@@ -375,8 +461,9 @@
|
||||
this.panel3.Controls.Add(this.panel2);
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel3.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(637, 738);
|
||||
this.panel3.Size = new System.Drawing.Size(822, 922);
|
||||
this.panel3.TabIndex = 3;
|
||||
//
|
||||
// panel6
|
||||
@@ -384,32 +471,35 @@
|
||||
this.panel6.Controls.Add(this.dv1);
|
||||
this.panel6.Controls.Add(this.statusStrip1);
|
||||
this.panel6.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel6.Location = new System.Drawing.Point(0, 174);
|
||||
this.panel6.Location = new System.Drawing.Point(0, 216);
|
||||
this.panel6.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panel6.Name = "panel6";
|
||||
this.panel6.Size = new System.Drawing.Size(637, 564);
|
||||
this.panel6.Size = new System.Drawing.Size(822, 706);
|
||||
this.panel6.TabIndex = 3;
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.lblStatus,
|
||||
this.lbSite});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 542);
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 680);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(637, 22);
|
||||
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0);
|
||||
this.statusStrip1.Size = new System.Drawing.Size(822, 26);
|
||||
this.statusStrip1.TabIndex = 2;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// lblStatus
|
||||
//
|
||||
this.lblStatus.Name = "lblStatus";
|
||||
this.lblStatus.Size = new System.Drawing.Size(27, 20);
|
||||
this.lblStatus.Size = new System.Drawing.Size(34, 24);
|
||||
this.lblStatus.Text = "WD";
|
||||
//
|
||||
// lbSite
|
||||
//
|
||||
this.lbSite.Name = "lbSite";
|
||||
this.lbSite.Size = new System.Drawing.Size(55, 17);
|
||||
this.lbSite.Size = new System.Drawing.Size(68, 20);
|
||||
this.lbSite.Text = "-- Site --";
|
||||
//
|
||||
// panel4
|
||||
@@ -422,26 +512,29 @@
|
||||
this.panel4.Controls.Add(this.btn_ApplyFilter);
|
||||
this.panel4.Controls.Add(this.chk_spChar);
|
||||
this.panel4.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel4.Location = new System.Drawing.Point(0, 140);
|
||||
this.panel4.Location = new System.Drawing.Point(0, 174);
|
||||
this.panel4.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panel4.Name = "panel4";
|
||||
this.panel4.Size = new System.Drawing.Size(637, 34);
|
||||
this.panel4.Size = new System.Drawing.Size(822, 42);
|
||||
this.panel4.TabIndex = 2;
|
||||
//
|
||||
// chk_RemoveBrit
|
||||
//
|
||||
this.chk_RemoveBrit.AutoSize = true;
|
||||
this.chk_RemoveBrit.Location = new System.Drawing.Point(113, 8);
|
||||
this.chk_RemoveBrit.Location = new System.Drawing.Point(129, 10);
|
||||
this.chk_RemoveBrit.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.chk_RemoveBrit.Name = "chk_RemoveBrit";
|
||||
this.chk_RemoveBrit.Size = new System.Drawing.Size(128, 16);
|
||||
this.chk_RemoveBrit.Size = new System.Drawing.Size(159, 19);
|
||||
this.chk_RemoveBrit.TabIndex = 0;
|
||||
this.chk_RemoveBrit.Text = "괄호안의 문자 제거";
|
||||
this.chk_RemoveBrit.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_ResultEmpty
|
||||
//
|
||||
this.btn_ResultEmpty.Location = new System.Drawing.Point(471, 4);
|
||||
this.btn_ResultEmpty.Location = new System.Drawing.Point(538, 5);
|
||||
this.btn_ResultEmpty.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_ResultEmpty.Name = "btn_ResultEmpty";
|
||||
this.btn_ResultEmpty.Size = new System.Drawing.Size(75, 24);
|
||||
this.btn_ResultEmpty.Size = new System.Drawing.Size(86, 30);
|
||||
this.btn_ResultEmpty.TabIndex = 2;
|
||||
this.btn_ResultEmpty.Text = "결과 비움";
|
||||
this.btn_ResultEmpty.UseVisualStyleBackColor = true;
|
||||
@@ -449,9 +542,10 @@
|
||||
//
|
||||
// btn_GridReset
|
||||
//
|
||||
this.btn_GridReset.Location = new System.Drawing.Point(548, 4);
|
||||
this.btn_GridReset.Location = new System.Drawing.Point(626, 5);
|
||||
this.btn_GridReset.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_GridReset.Name = "btn_GridReset";
|
||||
this.btn_GridReset.Size = new System.Drawing.Size(75, 24);
|
||||
this.btn_GridReset.Size = new System.Drawing.Size(86, 30);
|
||||
this.btn_GridReset.TabIndex = 2;
|
||||
this.btn_GridReset.Text = "표 비우기";
|
||||
this.btn_GridReset.UseVisualStyleBackColor = true;
|
||||
@@ -459,9 +553,10 @@
|
||||
//
|
||||
// btn_OpenMemo
|
||||
//
|
||||
this.btn_OpenMemo.Location = new System.Drawing.Point(394, 4);
|
||||
this.btn_OpenMemo.Location = new System.Drawing.Point(450, 5);
|
||||
this.btn_OpenMemo.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_OpenMemo.Name = "btn_OpenMemo";
|
||||
this.btn_OpenMemo.Size = new System.Drawing.Size(75, 24);
|
||||
this.btn_OpenMemo.Size = new System.Drawing.Size(86, 30);
|
||||
this.btn_OpenMemo.TabIndex = 2;
|
||||
this.btn_OpenMemo.Text = ".txt 열기";
|
||||
this.btn_OpenMemo.UseVisualStyleBackColor = true;
|
||||
@@ -470,30 +565,34 @@
|
||||
// chk_spChar
|
||||
//
|
||||
this.chk_spChar.AutoSize = true;
|
||||
this.chk_spChar.Location = new System.Drawing.Point(7, 8);
|
||||
this.chk_spChar.Location = new System.Drawing.Point(8, 10);
|
||||
this.chk_spChar.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.chk_spChar.Name = "chk_spChar";
|
||||
this.chk_spChar.Size = new System.Drawing.Size(100, 16);
|
||||
this.chk_spChar.Size = new System.Drawing.Size(124, 19);
|
||||
this.chk_spChar.TabIndex = 0;
|
||||
this.chk_spChar.Text = "특수문자 제거";
|
||||
this.chk_spChar.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// Check_copyWD
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(637, 738);
|
||||
this.ClientSize = new System.Drawing.Size(822, 922);
|
||||
this.Controls.Add(this.panel3);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "Check_copyWD";
|
||||
this.Text = "복본조사(New)";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Check_copy_FormClosing);
|
||||
this.Load += new System.EventHandler(this.Check_copy_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudAddDelay)).EndInit();
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dv1)).EndInit();
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.panel3.ResumeLayout(false);
|
||||
this.panel6.ResumeLayout(false);
|
||||
this.panel6.PerformLayout();
|
||||
@@ -508,7 +607,7 @@
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Label btSearchLibrary;
|
||||
private System.Windows.Forms.Button btSearchLibrary;
|
||||
private System.Windows.Forms.Panel panel2;
|
||||
private System.Windows.Forms.Button btn_Close;
|
||||
private System.Windows.Forms.Button btn_Stop;
|
||||
@@ -536,13 +635,19 @@
|
||||
private System.Windows.Forms.RadioButton radTargetErr;
|
||||
private System.Windows.Forms.RadioButton radTargetEmpty;
|
||||
private System.Windows.Forms.RadioButton radTargetErrEmpty;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn book_name;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn book_comp;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Count;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dvc_remark;
|
||||
public System.Windows.Forms.CheckBox chkRetryErrData;
|
||||
public System.Windows.Forms.GroupBox groupBox1;
|
||||
public System.Windows.Forms.CheckBox chkShowBrowser;
|
||||
private System.Windows.Forms.ToolStripStatusLabel lbSite;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem 유니코드문자로붙여넝ㅎ기ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem 일반문자로붙여넣기ToolStripMenuItem;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn book_name;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn book_comp;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Count;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dvc_remark;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dvc_resulthtml;
|
||||
private System.Windows.Forms.NumericUpDown nudAddDelay;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,9 @@ using AR;
|
||||
using UniMarc.SearchModel;
|
||||
using System.Linq;
|
||||
using UniMarc;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WindowsFormsApp1.Mac
|
||||
{
|
||||
@@ -28,7 +31,7 @@ namespace WindowsFormsApp1.Mac
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DateTime.Now <= new DateTime(2025, 09, 30));
|
||||
return (DateTime.Now <= new DateTime(2025, 12, 30));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -38,6 +41,9 @@ namespace WindowsFormsApp1.Mac
|
||||
main = _main;
|
||||
db.DBcon();
|
||||
|
||||
// 도서관별 지연시간 설정 초기화
|
||||
_delaySettings = new Helper_LibraryDelaySettings();
|
||||
|
||||
var idx = 1;
|
||||
//도서검색(크롤링)
|
||||
_searchService = new BookSearchService();
|
||||
@@ -49,7 +55,7 @@ namespace WindowsFormsApp1.Mac
|
||||
_searchService.AddSearcher(new NamguLibrarySearcher(idx++, "#libSW", "효천어울림도서관"));
|
||||
|
||||
|
||||
if (GetDemoRunAuth == true)
|
||||
|
||||
{
|
||||
//광주시교육청통합도서관
|
||||
_searchService.AddSearcher(new KwangjuCityEduLibrarySearcher(idx++, "MD", "중앙도서관"));
|
||||
@@ -405,6 +411,21 @@ namespace WindowsFormsApp1.Mac
|
||||
|
||||
}
|
||||
|
||||
//고창도서관 추가 250903
|
||||
|
||||
_searchService.AddSearcher(new GochangLibSearcher(idx++, "MA", "고창군립도서관"));
|
||||
_searchService.AddSearcher(new GochangLibSearcher(idx++, "MB", "선운산작은도서관"));
|
||||
_searchService.AddSearcher(new GochangLibSearcher(idx++, "MC", "고수해마루작은도서관"));
|
||||
_searchService.AddSearcher(new GochangLibSearcher(idx++, "MD", "고창군립성호도서관"));
|
||||
_searchService.AddSearcher(new GochangLibSearcher(idx++, "ME", "대산큰별작은도서관"));
|
||||
_searchService.AddSearcher(new GochangLibSearcher(idx++, "MF", "무장글샘작은도서관"));
|
||||
_searchService.AddSearcher(new GochangLibSearcher(idx++, "MG", "글마루작은도서관"));
|
||||
_searchService.AddSearcher(new GochangLibSearcher(idx++, "MH", "흥덕가온누리작은도서관"));
|
||||
_searchService.AddSearcher(new GochangLibSearcher(idx++, "MI", "공음참나무골작은도서관"));
|
||||
|
||||
//전라남도립도서관 추가 250917
|
||||
_searchService.AddSearcher(new JeonnamProvLibSearcher(idx++, "all", "전라남도립도서관"));
|
||||
|
||||
this.tb_SearchTarget.Items.Clear();
|
||||
// this.tb_SearchTarget.Items.Add("-- 검색대상을 선택하세요 --");
|
||||
foreach (var item in _searchService.GetAvailableSites().OrderBy(t => t))
|
||||
@@ -436,6 +457,7 @@ namespace WindowsFormsApp1.Mac
|
||||
|
||||
private readonly BookSearchService _searchService;
|
||||
private bool _isSearching = false;
|
||||
private readonly Helper_LibraryDelaySettings _delaySettings;
|
||||
|
||||
private async void InitializeChromeDriver()
|
||||
{
|
||||
@@ -533,13 +555,23 @@ namespace WindowsFormsApp1.Mac
|
||||
string Target = tb_SearchTarget.Text;
|
||||
// if (Target == "") { MessageBox.Show("도서관명이 비어있습니다."); return; }
|
||||
|
||||
string area = "`Province`, `Area`, `LibName`, `Code`, `URL`, `SearcherNo`";
|
||||
string cmd = string.Format("SELECT {0} FROM `lib_CopyCheck` WHERE CONCAT( province , '_' , AREA , '_' , libname) LIKE '%{1}%' and ifnull(searcherno,0) > 0 ;", area, Target);
|
||||
string data = db.self_Made_Cmd(cmd);
|
||||
string[] ary = data.Split('|');
|
||||
Check_Copy_Sub_Search ccs = new Check_Copy_Sub_Search(this);
|
||||
ccs.Init(ary, Target);
|
||||
ccs.Show();
|
||||
List<string> items = new List<string>();
|
||||
foreach (string item in tb_SearchTarget.Items)
|
||||
{
|
||||
if (items.Contains(item) == false) items.Add(item);
|
||||
}
|
||||
|
||||
|
||||
//string area = "`Province`, `Area`, `LibName`, `Code`, `URL`, `SearcherNo`";
|
||||
//string cmd = string.Format("SELECT {0} FROM `lib_CopyCheck` WHERE CONCAT( province , '_' , AREA , '_' , libname) LIKE '%{1}%' and ifnull(searcherno,0) > 0 ;", area, Target);
|
||||
//string data = db.self_Made_Cmd(cmd);
|
||||
string[] ary = items.ToArray();// data.Split('|');
|
||||
using (var ccs = new Check_Copy_Sub_Selector(items.ToArray(), Target))
|
||||
{
|
||||
ccs.ShowDialog();
|
||||
if (ccs.SelectedValue.isEmpty() == false)
|
||||
tb_SearchTarget.Text = ccs.SelectedValue;
|
||||
}
|
||||
}
|
||||
|
||||
private void btn_SearchList_Click(object sender, EventArgs e)
|
||||
@@ -598,7 +630,10 @@ namespace WindowsFormsApp1.Mac
|
||||
int cnt_ok = 0;
|
||||
int cnt_ng = 0;
|
||||
int cnt_er = 0;
|
||||
int addDelay = (int)nudAddDelay.Value * 1000; //추가 지연시간 : 1개의 레코드 처리 후 추가 지연한다.
|
||||
|
||||
// 현재 지연시간을 도서관별로 저장
|
||||
SaveLibraryDelaySettings(searcher.SiteName, (int)nudAddDelay.Value);
|
||||
|
||||
RetrySearch:
|
||||
foreach (DataGridViewRow drow in this.dv1.Rows)
|
||||
@@ -606,6 +641,10 @@ namespace WindowsFormsApp1.Mac
|
||||
if (this._isSearching == false)
|
||||
{
|
||||
drow.Cells["dvc_remark"].Value = "Cancel";
|
||||
if (dv1.Columns.Contains("dvc_resulthtml"))
|
||||
{
|
||||
drow.Cells["dvc_resulthtml"].Value = "";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -616,6 +655,10 @@ namespace WindowsFormsApp1.Mac
|
||||
{
|
||||
cnt_skip += 1;
|
||||
drow.Cells["dvc_remark"].Value = "No Title";
|
||||
if (dv1.Columns.Contains("dvc_resulthtml"))
|
||||
{
|
||||
drow.Cells["dvc_resulthtml"].Value = "";
|
||||
}
|
||||
drow.DefaultCellStyle.BackColor = Color.HotPink;
|
||||
drow.DefaultCellStyle.ForeColor = Color.Blue;
|
||||
continue;
|
||||
@@ -646,6 +689,13 @@ namespace WindowsFormsApp1.Mac
|
||||
{
|
||||
drow.Cells["dvc_remark"].Value = rlt.ErrorMessage;
|
||||
drow.Cells["Count"].Value = $"{rlt.BookCount}";
|
||||
|
||||
// ResultHtml을 dvc_resulthtml 컬럼에 저장
|
||||
if (dv1.Columns.Contains("dvc_resulthtml"))
|
||||
{
|
||||
drow.Cells["dvc_resulthtml"].Value = rlt.Resulthtml ?? "";
|
||||
}
|
||||
|
||||
if (rlt.BookCount == 0)
|
||||
{
|
||||
cnt_ng += 1;
|
||||
@@ -663,9 +713,18 @@ namespace WindowsFormsApp1.Mac
|
||||
{
|
||||
cnt_er += 1;
|
||||
drow.Cells["dvc_remark"].Value = $"Error|{rlt.ErrorMessage}";
|
||||
|
||||
// 오류시에도 ResultHtml이 있으면 저장 (디버깅용)
|
||||
if (dv1.Columns.Contains("dvc_resulthtml"))
|
||||
{
|
||||
drow.Cells["dvc_resulthtml"].Value = rlt.Resulthtml ?? "";
|
||||
}
|
||||
|
||||
drow.DefaultCellStyle.BackColor = Color.HotPink;
|
||||
drow.DefaultCellStyle.ForeColor = Color.Blue;
|
||||
}
|
||||
if (addDelay > 0)
|
||||
await Task.Delay(addDelay);
|
||||
}
|
||||
|
||||
if (_isSearching == true && retry == false && chkRetryErrData.Checked)
|
||||
@@ -847,6 +906,12 @@ namespace WindowsFormsApp1.Mac
|
||||
dv1.Rows[a].DefaultCellStyle.BackColor = Color.White;
|
||||
dv1.Rows[a].Cells["Count"].Value = "";
|
||||
dv1.Rows[a].Cells["dvc_remark"].Value = "";
|
||||
|
||||
// dvc_resulthtml 컬럼도 초기화
|
||||
if (dv1.Columns.Contains("dvc_resulthtml"))
|
||||
{
|
||||
dv1.Rows[a].Cells["dvc_resulthtml"].Value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -898,6 +963,67 @@ namespace WindowsFormsApp1.Mac
|
||||
}
|
||||
chkShowBrowser.Enabled = !searcher.HttpApiMode;
|
||||
this.lbSite.Text = $"[{searcher.AreaCode}] {searcher.SiteUrl}";
|
||||
|
||||
// 저장된 지연시간 불러오기
|
||||
LoadLibraryDelaySettings(searcher.SiteName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 선택된 도서관의 저장된 지연시간을 불러와서 UI에 설정
|
||||
/// </summary>
|
||||
/// <param name="libraryName">도서관 이름</param>
|
||||
private void LoadLibraryDelaySettings(string libraryName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var savedDelay = _delaySettings.GetDelay(libraryName);
|
||||
if (savedDelay > 0)
|
||||
{
|
||||
nudAddDelay.Value = savedDelay;
|
||||
Console.WriteLine($"도서관 지연시간 불러옴: {libraryName} = {savedDelay}초");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 저장된 설정이 없으면 기본값 유지
|
||||
Console.WriteLine($"도서관 지연시간 설정 없음, 기본값 사용: {libraryName}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"도서관 지연시간 불러오기 오류: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 검색 시작시 현재 지연시간을 저장
|
||||
/// </summary>
|
||||
/// <param name="libraryName">도서관 이름</param>
|
||||
/// <param name="delaySeconds">지연시간(초)</param>
|
||||
private void SaveLibraryDelaySettings(string libraryName, int delaySeconds)
|
||||
{
|
||||
try
|
||||
{
|
||||
_delaySettings.SetDelay(libraryName, delaySeconds);
|
||||
Console.WriteLine($"도서관 지연시간 저장됨: {libraryName} = {delaySeconds}초");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"도서관 지연시간 저장 오류: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void 유니코드문자로붙여넝ㅎ기ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Skill_Grid sg = new Skill_Grid();
|
||||
var newkey = new KeyEventArgs(Keys.Control | Keys.V | Keys.Alt);
|
||||
sg.Excel_to_DataGridView(this.dv1, newkey);
|
||||
}
|
||||
|
||||
private void 일반문자로붙여넣기ToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Skill_Grid sg = new Skill_Grid();
|
||||
var newkey = new KeyEventArgs(Keys.Control | Keys.V);
|
||||
sg.Excel_to_DataGridView(this.dv1, newkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,12 @@
|
||||
<metadata name="dvc_remark.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="dvc_resulthtml.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>134, 17</value>
|
||||
</metadata>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
|
||||
262
unimarc/unimarc/마크/DLS_Copy.Designer.cs
generated
262
unimarc/unimarc/마크/DLS_Copy.Designer.cs
generated
@@ -32,12 +32,18 @@
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel8 = new System.Windows.Forms.Panel();
|
||||
this.dv1 = new System.Windows.Forms.DataGridView();
|
||||
this.Book_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ISBN = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dvc_count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dvc_Remark = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.panel5 = new System.Windows.Forms.Panel();
|
||||
this.chkShowBrowser = new System.Windows.Forms.CheckBox();
|
||||
this.btn_ResultEmpty = new System.Windows.Forms.Button();
|
||||
this.btn_GridReset = new System.Windows.Forms.Button();
|
||||
this.chk_RemoveBrit = new System.Windows.Forms.CheckBox();
|
||||
this.chk_spChar = new System.Windows.Forms.CheckBox();
|
||||
this.btn_ApplyFilter = new System.Windows.Forms.Button();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.chkShowBrowser = new System.Windows.Forms.CheckBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.rBtn_ISBN = new System.Windows.Forms.RadioButton();
|
||||
this.btnStop = new System.Windows.Forms.Button();
|
||||
@@ -53,12 +59,8 @@
|
||||
this.tb_SearchClient = new System.Windows.Forms.TextBox();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.lblStatus = new System.Windows.Forms.ToolStripLabel();
|
||||
this.btn_ResultEmpty = new System.Windows.Forms.Button();
|
||||
this.btn_GridReset = new System.Windows.Forms.Button();
|
||||
this.Book_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.ISBN = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dvc_count = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dvc_Remark = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.nudAddDelay = new System.Windows.Forms.NumericUpDown();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel8.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dv1)).BeginInit();
|
||||
@@ -66,14 +68,16 @@
|
||||
this.panel3.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudAddDelay)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(7, 5);
|
||||
this.label1.Location = new System.Drawing.Point(8, 6);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(63, 22);
|
||||
this.label1.Size = new System.Drawing.Size(88, 31);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "납품처명";
|
||||
this.label1.Click += new System.EventHandler(this.label1_Click);
|
||||
@@ -87,17 +91,19 @@
|
||||
this.panel1.Controls.Add(this.panel2);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(640, 699);
|
||||
this.panel1.Size = new System.Drawing.Size(731, 879);
|
||||
this.panel1.TabIndex = 1;
|
||||
//
|
||||
// panel8
|
||||
//
|
||||
this.panel8.Controls.Add(this.dv1);
|
||||
this.panel8.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel8.Location = new System.Drawing.Point(0, 103);
|
||||
this.panel8.Location = new System.Drawing.Point(0, 127);
|
||||
this.panel8.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panel8.Name = "panel8";
|
||||
this.panel8.Size = new System.Drawing.Size(638, 594);
|
||||
this.panel8.Size = new System.Drawing.Size(729, 750);
|
||||
this.panel8.TabIndex = 5;
|
||||
//
|
||||
// dv1
|
||||
@@ -112,14 +118,44 @@
|
||||
this.dvc_Remark});
|
||||
this.dv1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dv1.Location = new System.Drawing.Point(0, 0);
|
||||
this.dv1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.dv1.Name = "dv1";
|
||||
this.dv1.RowHeadersWidth = 31;
|
||||
this.dv1.RowTemplate.Height = 23;
|
||||
this.dv1.Size = new System.Drawing.Size(638, 594);
|
||||
this.dv1.Size = new System.Drawing.Size(729, 750);
|
||||
this.dv1.TabIndex = 0;
|
||||
this.dv1.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dataGridView1_RowPostPaint);
|
||||
this.dv1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView1_KeyDown);
|
||||
//
|
||||
// Book_name
|
||||
//
|
||||
this.Book_name.HeaderText = "도서명";
|
||||
this.Book_name.MinimumWidth = 6;
|
||||
this.Book_name.Name = "Book_name";
|
||||
this.Book_name.Width = 140;
|
||||
//
|
||||
// ISBN
|
||||
//
|
||||
this.ISBN.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
|
||||
this.ISBN.HeaderText = "ISBN";
|
||||
this.ISBN.MinimumWidth = 6;
|
||||
this.ISBN.Name = "ISBN";
|
||||
this.ISBN.Width = 140;
|
||||
//
|
||||
// dvc_count
|
||||
//
|
||||
this.dvc_count.HeaderText = "검색";
|
||||
this.dvc_count.MinimumWidth = 6;
|
||||
this.dvc_count.Name = "dvc_count";
|
||||
this.dvc_count.Width = 125;
|
||||
//
|
||||
// dvc_Remark
|
||||
//
|
||||
this.dvc_Remark.HeaderText = "비고";
|
||||
this.dvc_Remark.MinimumWidth = 6;
|
||||
this.dvc_Remark.Name = "dvc_Remark";
|
||||
this.dvc_Remark.Width = 200;
|
||||
//
|
||||
// panel5
|
||||
//
|
||||
this.panel5.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
@@ -129,30 +165,41 @@
|
||||
this.panel5.Controls.Add(this.chk_spChar);
|
||||
this.panel5.Controls.Add(this.btn_ApplyFilter);
|
||||
this.panel5.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel5.Location = new System.Drawing.Point(0, 68);
|
||||
this.panel5.Location = new System.Drawing.Point(0, 84);
|
||||
this.panel5.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panel5.Name = "panel5";
|
||||
this.panel5.Size = new System.Drawing.Size(638, 35);
|
||||
this.panel5.Size = new System.Drawing.Size(729, 43);
|
||||
this.panel5.TabIndex = 4;
|
||||
//
|
||||
// chkShowBrowser
|
||||
// btn_ResultEmpty
|
||||
//
|
||||
this.chkShowBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.chkShowBrowser.AutoSize = true;
|
||||
this.chkShowBrowser.Checked = true;
|
||||
this.chkShowBrowser.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.chkShowBrowser.Location = new System.Drawing.Point(354, 9);
|
||||
this.chkShowBrowser.Name = "chkShowBrowser";
|
||||
this.chkShowBrowser.Size = new System.Drawing.Size(96, 16);
|
||||
this.chkShowBrowser.TabIndex = 209;
|
||||
this.chkShowBrowser.Text = "브라우저표시";
|
||||
this.chkShowBrowser.UseVisualStyleBackColor = true;
|
||||
this.btn_ResultEmpty.Location = new System.Drawing.Point(546, 5);
|
||||
this.btn_ResultEmpty.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_ResultEmpty.Name = "btn_ResultEmpty";
|
||||
this.btn_ResultEmpty.Size = new System.Drawing.Size(86, 30);
|
||||
this.btn_ResultEmpty.TabIndex = 6;
|
||||
this.btn_ResultEmpty.Text = "결과 비움";
|
||||
this.btn_ResultEmpty.UseVisualStyleBackColor = true;
|
||||
this.btn_ResultEmpty.Click += new System.EventHandler(this.btn_ResultEmpty_Click);
|
||||
//
|
||||
// btn_GridReset
|
||||
//
|
||||
this.btn_GridReset.Location = new System.Drawing.Point(634, 5);
|
||||
this.btn_GridReset.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_GridReset.Name = "btn_GridReset";
|
||||
this.btn_GridReset.Size = new System.Drawing.Size(86, 30);
|
||||
this.btn_GridReset.TabIndex = 7;
|
||||
this.btn_GridReset.Text = "표 비우기";
|
||||
this.btn_GridReset.UseVisualStyleBackColor = true;
|
||||
this.btn_GridReset.Click += new System.EventHandler(this.btn_GridReset_Click);
|
||||
//
|
||||
// chk_RemoveBrit
|
||||
//
|
||||
this.chk_RemoveBrit.AutoSize = true;
|
||||
this.chk_RemoveBrit.Location = new System.Drawing.Point(116, 8);
|
||||
this.chk_RemoveBrit.Location = new System.Drawing.Point(133, 10);
|
||||
this.chk_RemoveBrit.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.chk_RemoveBrit.Name = "chk_RemoveBrit";
|
||||
this.chk_RemoveBrit.Size = new System.Drawing.Size(128, 16);
|
||||
this.chk_RemoveBrit.Size = new System.Drawing.Size(159, 19);
|
||||
this.chk_RemoveBrit.TabIndex = 3;
|
||||
this.chk_RemoveBrit.Text = "괄호안의 문자 제거";
|
||||
this.chk_RemoveBrit.UseVisualStyleBackColor = true;
|
||||
@@ -160,9 +207,10 @@
|
||||
// chk_spChar
|
||||
//
|
||||
this.chk_spChar.AutoSize = true;
|
||||
this.chk_spChar.Location = new System.Drawing.Point(10, 8);
|
||||
this.chk_spChar.Location = new System.Drawing.Point(11, 10);
|
||||
this.chk_spChar.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.chk_spChar.Name = "chk_spChar";
|
||||
this.chk_spChar.Size = new System.Drawing.Size(100, 16);
|
||||
this.chk_spChar.Size = new System.Drawing.Size(124, 19);
|
||||
this.chk_spChar.TabIndex = 4;
|
||||
this.chk_spChar.Text = "특수문자 제거";
|
||||
this.chk_spChar.UseVisualStyleBackColor = true;
|
||||
@@ -170,9 +218,10 @@
|
||||
// btn_ApplyFilter
|
||||
//
|
||||
this.btn_ApplyFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_ApplyFilter.Location = new System.Drawing.Point(258, 4);
|
||||
this.btn_ApplyFilter.Location = new System.Drawing.Point(295, 5);
|
||||
this.btn_ApplyFilter.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_ApplyFilter.Name = "btn_ApplyFilter";
|
||||
this.btn_ApplyFilter.Size = new System.Drawing.Size(75, 24);
|
||||
this.btn_ApplyFilter.Size = new System.Drawing.Size(86, 30);
|
||||
this.btn_ApplyFilter.TabIndex = 5;
|
||||
this.btn_ApplyFilter.Text = "필터적용";
|
||||
this.btn_ApplyFilter.UseVisualStyleBackColor = true;
|
||||
@@ -181,6 +230,8 @@
|
||||
// panel3
|
||||
//
|
||||
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel3.Controls.Add(this.label3);
|
||||
this.panel3.Controls.Add(this.nudAddDelay);
|
||||
this.panel3.Controls.Add(this.chkShowBrowser);
|
||||
this.panel3.Controls.Add(this.label2);
|
||||
this.panel3.Controls.Add(this.rBtn_ISBN);
|
||||
@@ -188,17 +239,32 @@
|
||||
this.panel3.Controls.Add(this.btn_Search);
|
||||
this.panel3.Controls.Add(this.rBtn_BookName);
|
||||
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel3.Location = new System.Drawing.Point(0, 33);
|
||||
this.panel3.Location = new System.Drawing.Point(0, 41);
|
||||
this.panel3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panel3.Name = "panel3";
|
||||
this.panel3.Size = new System.Drawing.Size(638, 35);
|
||||
this.panel3.Size = new System.Drawing.Size(729, 43);
|
||||
this.panel3.TabIndex = 4;
|
||||
//
|
||||
// chkShowBrowser
|
||||
//
|
||||
this.chkShowBrowser.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.chkShowBrowser.AutoSize = true;
|
||||
this.chkShowBrowser.Checked = true;
|
||||
this.chkShowBrowser.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.chkShowBrowser.Location = new System.Drawing.Point(395, 11);
|
||||
this.chkShowBrowser.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.chkShowBrowser.Name = "chkShowBrowser";
|
||||
this.chkShowBrowser.Size = new System.Drawing.Size(119, 19);
|
||||
this.chkShowBrowser.TabIndex = 209;
|
||||
this.chkShowBrowser.Text = "브라우저표시";
|
||||
this.chkShowBrowser.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(7, 11);
|
||||
this.label2.Location = new System.Drawing.Point(8, 14);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(53, 12);
|
||||
this.label2.Size = new System.Drawing.Size(67, 15);
|
||||
this.label2.TabIndex = 3;
|
||||
this.label2.Text = "검색조건";
|
||||
//
|
||||
@@ -206,9 +272,10 @@
|
||||
//
|
||||
this.rBtn_ISBN.AutoSize = true;
|
||||
this.rBtn_ISBN.Checked = true;
|
||||
this.rBtn_ISBN.Location = new System.Drawing.Point(153, 9);
|
||||
this.rBtn_ISBN.Location = new System.Drawing.Point(175, 11);
|
||||
this.rBtn_ISBN.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.rBtn_ISBN.Name = "rBtn_ISBN";
|
||||
this.rBtn_ISBN.Size = new System.Drawing.Size(51, 16);
|
||||
this.rBtn_ISBN.Size = new System.Drawing.Size(60, 19);
|
||||
this.rBtn_ISBN.TabIndex = 4;
|
||||
this.rBtn_ISBN.TabStop = true;
|
||||
this.rBtn_ISBN.Text = "ISBN";
|
||||
@@ -216,9 +283,10 @@
|
||||
//
|
||||
// btnStop
|
||||
//
|
||||
this.btnStop.Location = new System.Drawing.Point(283, 5);
|
||||
this.btnStop.Location = new System.Drawing.Point(323, 6);
|
||||
this.btnStop.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btnStop.Name = "btnStop";
|
||||
this.btnStop.Size = new System.Drawing.Size(65, 23);
|
||||
this.btnStop.Size = new System.Drawing.Size(74, 29);
|
||||
this.btnStop.TabIndex = 2;
|
||||
this.btnStop.Text = "중 지";
|
||||
this.btnStop.UseVisualStyleBackColor = true;
|
||||
@@ -226,9 +294,10 @@
|
||||
//
|
||||
// btn_Search
|
||||
//
|
||||
this.btn_Search.Location = new System.Drawing.Point(217, 5);
|
||||
this.btn_Search.Location = new System.Drawing.Point(248, 6);
|
||||
this.btn_Search.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_Search.Name = "btn_Search";
|
||||
this.btn_Search.Size = new System.Drawing.Size(65, 23);
|
||||
this.btn_Search.Size = new System.Drawing.Size(74, 29);
|
||||
this.btn_Search.TabIndex = 2;
|
||||
this.btn_Search.Text = "검 색";
|
||||
this.btn_Search.UseVisualStyleBackColor = true;
|
||||
@@ -237,9 +306,10 @@
|
||||
// rBtn_BookName
|
||||
//
|
||||
this.rBtn_BookName.AutoSize = true;
|
||||
this.rBtn_BookName.Location = new System.Drawing.Point(68, 9);
|
||||
this.rBtn_BookName.Location = new System.Drawing.Point(78, 11);
|
||||
this.rBtn_BookName.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.rBtn_BookName.Name = "rBtn_BookName";
|
||||
this.rBtn_BookName.Size = new System.Drawing.Size(59, 16);
|
||||
this.rBtn_BookName.Size = new System.Drawing.Size(73, 19);
|
||||
this.rBtn_BookName.TabIndex = 4;
|
||||
this.rBtn_BookName.Text = "도서명";
|
||||
this.rBtn_BookName.UseVisualStyleBackColor = true;
|
||||
@@ -257,16 +327,18 @@
|
||||
this.panel2.Controls.Add(this.tb_SearchClient);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel2.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel2.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(638, 33);
|
||||
this.panel2.Size = new System.Drawing.Size(729, 41);
|
||||
this.panel2.TabIndex = 3;
|
||||
//
|
||||
// btn_SiteDenote
|
||||
//
|
||||
this.btn_SiteDenote.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_SiteDenote.Location = new System.Drawing.Point(555, 5);
|
||||
this.btn_SiteDenote.Location = new System.Drawing.Point(634, 6);
|
||||
this.btn_SiteDenote.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_SiteDenote.Name = "btn_SiteDenote";
|
||||
this.btn_SiteDenote.Size = new System.Drawing.Size(77, 23);
|
||||
this.btn_SiteDenote.Size = new System.Drawing.Size(88, 29);
|
||||
this.btn_SiteDenote.TabIndex = 6;
|
||||
this.btn_SiteDenote.Text = "사이트 표출";
|
||||
this.btn_SiteDenote.UseVisualStyleBackColor = true;
|
||||
@@ -275,9 +347,10 @@
|
||||
// btn_Connect
|
||||
//
|
||||
this.btn_Connect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btn_Connect.Location = new System.Drawing.Point(479, 5);
|
||||
this.btn_Connect.Location = new System.Drawing.Point(547, 6);
|
||||
this.btn_Connect.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.btn_Connect.Name = "btn_Connect";
|
||||
this.btn_Connect.Size = new System.Drawing.Size(70, 23);
|
||||
this.btn_Connect.Size = new System.Drawing.Size(80, 29);
|
||||
this.btn_Connect.TabIndex = 5;
|
||||
this.btn_Connect.Text = "접속";
|
||||
this.btn_Connect.UseVisualStyleBackColor = true;
|
||||
@@ -286,36 +359,36 @@
|
||||
// lbl_PW
|
||||
//
|
||||
this.lbl_PW.AutoSize = true;
|
||||
this.lbl_PW.Location = new System.Drawing.Point(297, 37);
|
||||
this.lbl_PW.Location = new System.Drawing.Point(339, 46);
|
||||
this.lbl_PW.Name = "lbl_PW";
|
||||
this.lbl_PW.Size = new System.Drawing.Size(23, 12);
|
||||
this.lbl_PW.Size = new System.Drawing.Size(31, 15);
|
||||
this.lbl_PW.TabIndex = 3;
|
||||
this.lbl_PW.Text = "PW";
|
||||
//
|
||||
// lbl_Area
|
||||
//
|
||||
this.lbl_Area.AutoSize = true;
|
||||
this.lbl_Area.Location = new System.Drawing.Point(97, 37);
|
||||
this.lbl_Area.Location = new System.Drawing.Point(111, 46);
|
||||
this.lbl_Area.Name = "lbl_Area";
|
||||
this.lbl_Area.Size = new System.Drawing.Size(31, 12);
|
||||
this.lbl_Area.Size = new System.Drawing.Size(36, 15);
|
||||
this.lbl_Area.TabIndex = 3;
|
||||
this.lbl_Area.Text = "Area";
|
||||
//
|
||||
// lbl_ID
|
||||
//
|
||||
this.lbl_ID.AutoSize = true;
|
||||
this.lbl_ID.Location = new System.Drawing.Point(185, 37);
|
||||
this.lbl_ID.Location = new System.Drawing.Point(211, 46);
|
||||
this.lbl_ID.Name = "lbl_ID";
|
||||
this.lbl_ID.Size = new System.Drawing.Size(16, 12);
|
||||
this.lbl_ID.Size = new System.Drawing.Size(20, 15);
|
||||
this.lbl_ID.TabIndex = 3;
|
||||
this.lbl_ID.Text = "ID";
|
||||
//
|
||||
// lbl_Client
|
||||
//
|
||||
this.lbl_Client.AutoSize = true;
|
||||
this.lbl_Client.Location = new System.Drawing.Point(7, 37);
|
||||
this.lbl_Client.Location = new System.Drawing.Point(8, 46);
|
||||
this.lbl_Client.Name = "lbl_Client";
|
||||
this.lbl_Client.Size = new System.Drawing.Size(37, 12);
|
||||
this.lbl_Client.Size = new System.Drawing.Size(43, 15);
|
||||
this.lbl_Client.TabIndex = 3;
|
||||
this.lbl_Client.Text = "Client";
|
||||
//
|
||||
@@ -324,80 +397,58 @@
|
||||
this.tb_SearchClient.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tb_SearchClient.ImeMode = System.Windows.Forms.ImeMode.Hangul;
|
||||
this.tb_SearchClient.Location = new System.Drawing.Point(76, 6);
|
||||
this.tb_SearchClient.Location = new System.Drawing.Point(87, 8);
|
||||
this.tb_SearchClient.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.tb_SearchClient.Name = "tb_SearchClient";
|
||||
this.tb_SearchClient.Size = new System.Drawing.Size(397, 21);
|
||||
this.tb_SearchClient.Size = new System.Drawing.Size(453, 25);
|
||||
this.tb_SearchClient.TabIndex = 1;
|
||||
this.tb_SearchClient.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tb_SearchClient_KeyDown);
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.lblStatus});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 699);
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 879);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(640, 22);
|
||||
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0);
|
||||
this.statusStrip1.Size = new System.Drawing.Size(731, 22);
|
||||
this.statusStrip1.TabIndex = 3;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// lblStatus
|
||||
//
|
||||
this.lblStatus.Name = "lblStatus";
|
||||
this.lblStatus.Size = new System.Drawing.Size(27, 20);
|
||||
this.lblStatus.Size = new System.Drawing.Size(34, 20);
|
||||
this.lblStatus.Text = "WD";
|
||||
this.lblStatus.Click += new System.EventHandler(this.lblStatus_Click);
|
||||
//
|
||||
// btn_ResultEmpty
|
||||
// label3
|
||||
//
|
||||
this.btn_ResultEmpty.Location = new System.Drawing.Point(478, 4);
|
||||
this.btn_ResultEmpty.Name = "btn_ResultEmpty";
|
||||
this.btn_ResultEmpty.Size = new System.Drawing.Size(75, 24);
|
||||
this.btn_ResultEmpty.TabIndex = 6;
|
||||
this.btn_ResultEmpty.Text = "결과 비움";
|
||||
this.btn_ResultEmpty.UseVisualStyleBackColor = true;
|
||||
this.btn_ResultEmpty.Click += new System.EventHandler(this.btn_ResultEmpty_Click);
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(591, 13);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(67, 15);
|
||||
this.label3.TabIndex = 211;
|
||||
this.label3.Text = "추가지연";
|
||||
//
|
||||
// btn_GridReset
|
||||
// nudAddDelay
|
||||
//
|
||||
this.btn_GridReset.Location = new System.Drawing.Point(555, 4);
|
||||
this.btn_GridReset.Name = "btn_GridReset";
|
||||
this.btn_GridReset.Size = new System.Drawing.Size(75, 24);
|
||||
this.btn_GridReset.TabIndex = 7;
|
||||
this.btn_GridReset.Text = "표 비우기";
|
||||
this.btn_GridReset.UseVisualStyleBackColor = true;
|
||||
this.btn_GridReset.Click += new System.EventHandler(this.btn_GridReset_Click);
|
||||
//
|
||||
// Book_name
|
||||
//
|
||||
this.Book_name.HeaderText = "도서명";
|
||||
this.Book_name.Name = "Book_name";
|
||||
this.Book_name.Width = 140;
|
||||
//
|
||||
// ISBN
|
||||
//
|
||||
this.ISBN.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
|
||||
this.ISBN.HeaderText = "ISBN";
|
||||
this.ISBN.Name = "ISBN";
|
||||
this.ISBN.Width = 140;
|
||||
//
|
||||
// dvc_count
|
||||
//
|
||||
this.dvc_count.HeaderText = "검색";
|
||||
this.dvc_count.Name = "dvc_count";
|
||||
//
|
||||
// dvc_Remark
|
||||
//
|
||||
this.dvc_Remark.HeaderText = "비고";
|
||||
this.dvc_Remark.Name = "dvc_Remark";
|
||||
this.dvc_Remark.Width = 200;
|
||||
this.nudAddDelay.Location = new System.Drawing.Point(658, 8);
|
||||
this.nudAddDelay.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.nudAddDelay.Name = "nudAddDelay";
|
||||
this.nudAddDelay.Size = new System.Drawing.Size(64, 25);
|
||||
this.nudAddDelay.TabIndex = 210;
|
||||
this.nudAddDelay.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
//
|
||||
// DLS_Copy
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(640, 721);
|
||||
this.ClientSize = new System.Drawing.Size(731, 901);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.Name = "DLS_Copy";
|
||||
this.Text = "DLS 복본조사";
|
||||
this.Load += new System.EventHandler(this.DLS_Copy_Load);
|
||||
@@ -412,6 +463,7 @@
|
||||
this.panel2.PerformLayout();
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudAddDelay)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -450,5 +502,7 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn ISBN;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dvc_count;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dvc_Remark;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.NumericUpDown nudAddDelay;
|
||||
}
|
||||
}
|
||||
@@ -212,6 +212,8 @@ namespace WindowsFormsApp1.Mac
|
||||
var sType = rBtn_ISBN.Checked ? "ea_isbn" : "title";
|
||||
_searcher.SetParameter(this.lbl_ID.Text, lbl_PW.Text, "유덕초등학교", sType);
|
||||
|
||||
int addDelay = (int)nudAddDelay.Value * 1000; //추가 지연시간 : 1개의 레코드 처리 후 추가 지연한다.
|
||||
|
||||
foreach (DataGridViewRow dr in this.dv1.Rows)
|
||||
{
|
||||
var title = dr.Cells[0].Value?.ToString() ?? string.Empty;
|
||||
@@ -232,6 +234,9 @@ namespace WindowsFormsApp1.Mac
|
||||
else
|
||||
dr.DefaultCellStyle.BackColor = Color.LightSkyBlue;
|
||||
}
|
||||
|
||||
if (addDelay > 0)
|
||||
await Task.Delay(addDelay);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Web.UI.WebControls;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using WindowsFormsApp1;
|
||||
using AR;
|
||||
|
||||
namespace UniMarc.마크
|
||||
{
|
||||
@@ -18,16 +19,16 @@ namespace UniMarc.마크
|
||||
|
||||
public Macro(string pIDX, string pTagArr, string pRuncode)
|
||||
{
|
||||
mIDX= pIDX;
|
||||
mTagArr= pTagArr;
|
||||
mRuncode= pRuncode;
|
||||
mIDX = pIDX;
|
||||
mTagArr = pTagArr;
|
||||
mRuncode = pRuncode;
|
||||
}
|
||||
}
|
||||
internal class Macro_Gudu
|
||||
{
|
||||
String_Text st = new String_Text();
|
||||
Helper_DB db;
|
||||
|
||||
|
||||
public Macro_Gudu(Helper_DB db)
|
||||
{
|
||||
this.db = db;
|
||||
@@ -36,7 +37,7 @@ namespace UniMarc.마크
|
||||
bool isAuthorTag = false;
|
||||
string Author_Idx_6768 = "";
|
||||
public string FileType = "ANSI";
|
||||
|
||||
|
||||
|
||||
public string MacroMarc(string ViewMarc, List<string> idx, List<string> TagArray, List<string> RunCode)
|
||||
{
|
||||
@@ -60,7 +61,7 @@ namespace UniMarc.마크
|
||||
string tContentTag = string.Empty;
|
||||
for (int i = 0; i < tMacroList.Count; i++)
|
||||
{
|
||||
if (tMacroList[i].mRuncode == "etc" || tMacroList[i].mRuncode.Contains("jisi") || (tMacroList[i].mRuncode.Contains("del")&& !tMacroList[i].mRuncode.Contains("/")))
|
||||
if (tMacroList[i].mRuncode == "etc" || tMacroList[i].mRuncode.Contains("jisi") || (tMacroList[i].mRuncode.Contains("del") && !tMacroList[i].mRuncode.Contains("/")))
|
||||
{
|
||||
if ((tMacroList[i].mIDX == "110" || tMacroList[i].mIDX == "111" || tMacroList[i].mIDX == "112")
|
||||
&& (tMacroList[i].mTagArr == "256" || tMacroList[i].mTagArr == "500")
|
||||
@@ -163,7 +164,7 @@ namespace UniMarc.마크
|
||||
string TargetTag = CodeSplit[0].Substring(3, 1);
|
||||
string MoveTagNum = CodeSplit[1].Substring(0, 3);
|
||||
string MoveTag = CodeSplit[1].Substring(3, 1);
|
||||
|
||||
|
||||
ViewMarc = TagToOtherTag(TargetTagNum, TargetTag, MoveTagNum, MoveTag, ViewMarc, isDelete);
|
||||
|
||||
#region 코드 간소화 작업진행중으로 주석처리 (나중에 삭제)
|
||||
@@ -221,7 +222,8 @@ namespace UniMarc.마크
|
||||
|
||||
if (TakeTag[0] != "")
|
||||
Tag += "▼a" + TakeTag[0];
|
||||
if (TakeTag[1] == "" && TakeTag[2] == "" && TakeTag[3] == "") {
|
||||
if (TakeTag[1] == "" && TakeTag[2] == "" && TakeTag[3] == "")
|
||||
{
|
||||
Tag += "▲";
|
||||
return st.AddTagInMarc(Tag, ViewMarc);
|
||||
}
|
||||
@@ -268,13 +270,16 @@ namespace UniMarc.마크
|
||||
{
|
||||
Jisi = ChangeJisi(idx, RunCode[cout], TagArray[cout], ContentTag, Jisi, Target);
|
||||
|
||||
if (RunCode[cout] == "del") {
|
||||
if (TagArray[cout] == ContentTag) {
|
||||
if (RunCode[cout] == "del")
|
||||
{
|
||||
if (TagArray[cout] == ContentTag)
|
||||
{
|
||||
Target = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ContentTag == "020" && Jisi == "1 " && idx == "75") {
|
||||
if (ContentTag == "020" && Jisi == "1 " && idx == "75")
|
||||
{
|
||||
Target = "";
|
||||
}
|
||||
switch (ContentTag)
|
||||
@@ -475,7 +480,7 @@ namespace UniMarc.마크
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
|
||||
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
@@ -521,7 +526,7 @@ namespace UniMarc.마크
|
||||
{
|
||||
if (SplitContent[a].StartsWith("a") && idx == "67")
|
||||
Author_Idx_6768 = SplitContent[a].Substring(1).Replace("▲", "");
|
||||
|
||||
|
||||
if (a <= 1) continue;
|
||||
|
||||
}
|
||||
@@ -578,6 +583,47 @@ namespace UniMarc.마크
|
||||
List<string> TMP = new List<string>(SplitContent);
|
||||
for (int a = 0; a < TMP.Count; a++)
|
||||
{
|
||||
|
||||
//빈데이터는 처리하지 않음
|
||||
if (TMP[a].isEmpty()) continue;
|
||||
|
||||
//각 요소뒤에 ; 붙이기 , 로 끝나지않는 경우에만 ,; 문자가 있다면 삭제한다.
|
||||
//아래 1보다 작다로 인해 a가 미처리되는 현상이 있어 위에다가 붙인다 2508014
|
||||
if (idx == "113" && (TMP[a].StartsWith("d") || TMP[a].StartsWith("e")))
|
||||
{
|
||||
// 새로운 구두점 적용 로직 (2024년 수정)
|
||||
var subfieldata = TMP[a].Trim();
|
||||
var endsignal = subfieldata.EndsWith("▲");
|
||||
if (endsignal) subfieldata = subfieldata.Substring(0, subfieldata.Length - 1);
|
||||
|
||||
// 현재 필드가 ,로 끝나지 않는 경우에만 ; 적용 검토
|
||||
if (!subfieldata.EndsWith(",") && !subfieldata.EndsWith(";"))
|
||||
{
|
||||
// 다음 필드가 d나 e인지 확인
|
||||
bool hasNextDE = false;
|
||||
for (int nextIdx = a + 1; nextIdx < TMP.Count; nextIdx++)
|
||||
{
|
||||
if (!TMP[nextIdx].isEmpty() && (TMP[nextIdx].StartsWith("d") || TMP[nextIdx].StartsWith("e")))
|
||||
{
|
||||
hasNextDE = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 다음에 d나 e 필드가 있으면 ; 적용
|
||||
if (hasNextDE)
|
||||
{
|
||||
subfieldata += ";";
|
||||
}
|
||||
}
|
||||
|
||||
// ,; 문자가 있다면 ;로 변경
|
||||
subfieldata = subfieldata.Replace(",;", ";");
|
||||
if (endsignal) subfieldata += "▲";
|
||||
TMP[a] = subfieldata;
|
||||
}
|
||||
|
||||
|
||||
if (a <= 1) continue;
|
||||
|
||||
#region 구두점 적용
|
||||
@@ -587,7 +633,7 @@ namespace UniMarc.마크
|
||||
if (TMP[a].StartsWith("a"))
|
||||
if (!TMP[a - 1].EndsWith(":"))
|
||||
TMP[a - 1] += ":";
|
||||
|
||||
|
||||
// $b 앞에 ":"적용
|
||||
if (TMP[a].StartsWith("b") && idx == "3")
|
||||
if (!TMP[a - 1].EndsWith(":"))
|
||||
@@ -648,7 +694,7 @@ namespace UniMarc.마크
|
||||
// 245h [대활자본] 문구적용
|
||||
if (TMP[a].StartsWith("h") && idx == "91")
|
||||
TMP[a] = "h[대활자본]" + TMP[a].Substring(1);
|
||||
|
||||
|
||||
// 245h [음악자료] 문구적용
|
||||
if (TMP[a].StartsWith("h") && idx == "92")
|
||||
TMP[a] = "h[음악자료]" + TMP[a].Substring(1);
|
||||
@@ -681,74 +727,76 @@ namespace UniMarc.마크
|
||||
if (end)
|
||||
TMP[a] += "▲";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 식별기호 삭제
|
||||
|
||||
// 245e 삭제
|
||||
if (TMP[a].StartsWith("e") && idx == "80")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 245b 삭제
|
||||
if (TMP[a].StartsWith("b") && idx == "81")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
// 245b 삭제
|
||||
if (TMP[a].StartsWith("b") && idx == "81")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 245x 삭제
|
||||
if (TMP[a].StartsWith("x") && idx == "82")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
// 245x 삭제
|
||||
if (TMP[a].StartsWith("x") && idx == "82")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 245n 삭제
|
||||
if (TMP[a].StartsWith("n") && idx == "83")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
// 245n 삭제
|
||||
if (TMP[a].StartsWith("n") && idx == "83")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 245p 삭제
|
||||
if (TMP[a].StartsWith("p") && idx == "84")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
// 245p 삭제
|
||||
if (TMP[a].StartsWith("p") && idx == "84")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 245h 삭제
|
||||
if (TMP[a].StartsWith("h") && idx == "85")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
// 245h 삭제
|
||||
if (TMP[a].StartsWith("h") && idx == "85")
|
||||
{
|
||||
if (TMP[a].Contains("▲"))
|
||||
TMP[a - 1] += "▲";
|
||||
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
TMP.RemoveAt(a);
|
||||
continue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
SplitContent = TMP.ToArray();
|
||||
return string.Join("▼", SplitContent);
|
||||
@@ -880,7 +928,8 @@ namespace UniMarc.마크
|
||||
if (idx == "101")
|
||||
SplitContent[a] = SplitContent[a].Replace("p.", "");
|
||||
// 300 a 맨 앞이 [ 로 시작 될 경우 300a를 [1책] 으로 수정
|
||||
if (idx == "105") {
|
||||
if (idx == "105")
|
||||
{
|
||||
string tmp = SplitContent[a].Substring(1);
|
||||
if (tmp.StartsWith("["))
|
||||
SplitContent[a] = "a[1책]";
|
||||
@@ -919,7 +968,8 @@ namespace UniMarc.마크
|
||||
SplitContent[a] = SplitContent[a].Replace("천연색삽화", "채색삽화");
|
||||
|
||||
// 300b "천연색, 유성" 으로 덮어 씌움
|
||||
if (idx == "109") {
|
||||
if (idx == "109")
|
||||
{
|
||||
SplitContent[a] = "b천연색, 유성";
|
||||
if (SplitContent[a].Contains("▲"))
|
||||
SplitContent[a] += "▲";
|
||||
@@ -929,12 +979,13 @@ namespace UniMarc.마크
|
||||
if (SplitContent[a].StartsWith("c"))
|
||||
{
|
||||
// $c 앞에는 ";" 적용
|
||||
if( idx == "19")
|
||||
if (idx == "19")
|
||||
if (!SplitContent[a - 1].EndsWith(";"))
|
||||
SplitContent[a - 1] += ";";
|
||||
|
||||
// $c X포함 뒷부분 삭제
|
||||
if (idx == "73") {
|
||||
if (idx == "73")
|
||||
{
|
||||
SplitContent[a] = SplitContent[a].ToLower();
|
||||
string[] tmp = SplitContent[a].Split('x');
|
||||
SplitContent[a] = tmp[0] + "cm▲";
|
||||
@@ -942,9 +993,10 @@ namespace UniMarc.마크
|
||||
}
|
||||
|
||||
// $e 앞에는 "+" 적용
|
||||
if (SplitContent[a].StartsWith("e") )
|
||||
if (SplitContent[a].StartsWith("e"))
|
||||
{
|
||||
if (idx == "20") {
|
||||
if (idx == "20")
|
||||
{
|
||||
if (!SplitContent[a - 1].EndsWith("+"))
|
||||
SplitContent[a - 1] += "+";
|
||||
}
|
||||
@@ -969,11 +1021,13 @@ namespace UniMarc.마크
|
||||
// $p 앞에 $n이 나온 경우 "," 적용, $p앞에 $n이 없는 경우 "."적용
|
||||
if (SplitContent[a].StartsWith("p") && idx == "22")
|
||||
{
|
||||
if (SplitContent[a - 1].StartsWith("n")) {
|
||||
if (SplitContent[a - 1].StartsWith("n"))
|
||||
{
|
||||
if (SplitContent[a - 1].EndsWith(","))
|
||||
SplitContent[a - 1] += ",";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (SplitContent[a - 1].EndsWith("."))
|
||||
SplitContent[a - 1] += ".";
|
||||
}
|
||||
@@ -1108,7 +1162,7 @@ namespace UniMarc.마크
|
||||
string TagToOtherTag(string TargetTagNum, string TargetTagAccount, string ApplyTagNum, string ApplyTagAccount, string ViewMarc, bool isDelete = false, string jisi = " ")
|
||||
{
|
||||
List<string> SplitMarc = new List<string>(ViewMarc.Split('\n'));
|
||||
|
||||
|
||||
string Target = "";
|
||||
|
||||
// 가져올 태그 정보 추출
|
||||
@@ -1141,7 +1195,7 @@ namespace UniMarc.마크
|
||||
if (SplitMarc[a].StartsWith(TargetTagNum) && SplitMarc[a].Contains(Target))
|
||||
{
|
||||
SplitMarc.RemoveAt(a);
|
||||
|
||||
|
||||
// string RemoveTarget = string.Format("▼{0}{1}", TargetTagAccount, Target);
|
||||
// SplitMarc[a] = SplitMarc[a].Replace(RemoveTarget, "");
|
||||
break;
|
||||
|
||||
68
unimarc/unimarc/마크/Marc_Plan.Designer.cs
generated
68
unimarc/unimarc/마크/Marc_Plan.Designer.cs
generated
@@ -29,7 +29,6 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Marc_Plan));
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
@@ -37,6 +36,7 @@
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Marc_Plan));
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.btn_ClassSymbol = new System.Windows.Forms.Button();
|
||||
@@ -118,8 +118,6 @@
|
||||
this.tb_Garo = new System.Windows.Forms.TextBox();
|
||||
this.panel7 = new System.Windows.Forms.Panel();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.printDocument1 = new System.Drawing.Printing.PrintDocument();
|
||||
this.printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();
|
||||
this.idx = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.num = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.reg_num = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
@@ -142,6 +140,10 @@
|
||||
this.marc = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.search_tag2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.printDocument1 = new System.Drawing.Printing.PrintDocument();
|
||||
this.printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();
|
||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel4.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
@@ -150,6 +152,7 @@
|
||||
this.panel6.SuspendLayout();
|
||||
this.panel7.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
this.toolStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
@@ -994,8 +997,9 @@
|
||||
//
|
||||
// panel7
|
||||
//
|
||||
this.panel7.Controls.Add(this.checkBox1);
|
||||
this.panel7.Controls.Add(this.dataGridView1);
|
||||
this.panel7.Controls.Add(this.toolStrip1);
|
||||
this.panel7.Controls.Add(this.checkBox1);
|
||||
this.panel7.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel7.Location = new System.Drawing.Point(0, 70);
|
||||
this.panel7.Name = "panel7";
|
||||
@@ -1047,7 +1051,7 @@
|
||||
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.RowTemplate.Height = 23;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1730, 783);
|
||||
this.dataGridView1.Size = new System.Drawing.Size(1730, 758);
|
||||
this.dataGridView1.TabIndex = 1;
|
||||
this.dataGridView1.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellClick);
|
||||
this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);
|
||||
@@ -1055,21 +1059,6 @@
|
||||
this.dataGridView1.SortCompare += new System.Windows.Forms.DataGridViewSortCompareEventHandler(this.dataGridView1_SortCompare);
|
||||
this.dataGridView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dataGridView1_KeyDown);
|
||||
//
|
||||
// printDocument1
|
||||
//
|
||||
this.printDocument1.BeginPrint += new System.Drawing.Printing.PrintEventHandler(this.printDocument1_BeginPrint);
|
||||
this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
|
||||
//
|
||||
// printPreviewDialog1
|
||||
//
|
||||
this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
||||
this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
||||
this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
|
||||
this.printPreviewDialog1.Enabled = true;
|
||||
this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
|
||||
this.printPreviewDialog1.Name = "printPreviewDialog1";
|
||||
this.printPreviewDialog1.Visible = false;
|
||||
//
|
||||
// idx
|
||||
//
|
||||
this.idx.HeaderText = "idx";
|
||||
@@ -1244,6 +1233,41 @@
|
||||
this.colCheck.TrueValue = "T";
|
||||
this.colCheck.Width = 27;
|
||||
//
|
||||
// printDocument1
|
||||
//
|
||||
this.printDocument1.BeginPrint += new System.Drawing.Printing.PrintEventHandler(this.printDocument1_BeginPrint);
|
||||
this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
|
||||
//
|
||||
// printPreviewDialog1
|
||||
//
|
||||
this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
||||
this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
||||
this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
|
||||
this.printPreviewDialog1.Enabled = true;
|
||||
this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
|
||||
this.printPreviewDialog1.Name = "printPreviewDialog1";
|
||||
this.printPreviewDialog1.Visible = false;
|
||||
//
|
||||
// toolStrip1
|
||||
//
|
||||
this.toolStrip1.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripButton1});
|
||||
this.toolStrip1.Location = new System.Drawing.Point(0, 758);
|
||||
this.toolStrip1.Name = "toolStrip1";
|
||||
this.toolStrip1.Size = new System.Drawing.Size(1730, 25);
|
||||
this.toolStrip1.TabIndex = 3;
|
||||
this.toolStrip1.Text = "toolStrip1";
|
||||
//
|
||||
// toolStripButton1
|
||||
//
|
||||
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
|
||||
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
this.toolStripButton1.Name = "toolStripButton1";
|
||||
this.toolStripButton1.Size = new System.Drawing.Size(59, 22);
|
||||
this.toolStripButton1.Text = "delete";
|
||||
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
|
||||
//
|
||||
// Marc_Plan
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
@@ -1270,6 +1294,8 @@
|
||||
this.panel7.ResumeLayout(false);
|
||||
this.panel7.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
||||
this.toolStrip1.ResumeLayout(false);
|
||||
this.toolStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -1383,5 +1409,7 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn marc;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn search_tag2;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck;
|
||||
private System.Windows.Forms.ToolStrip toolStrip1;
|
||||
private System.Windows.Forms.ToolStripButton toolStripButton1;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using ExcelTest;
|
||||
using AR;
|
||||
using ExcelTest;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -28,6 +29,7 @@ namespace WindowsFormsApp1.Mac
|
||||
{
|
||||
InitializeComponent();
|
||||
main = _main;
|
||||
this.toolStrip1.Visible = System.Diagnostics.Debugger.IsAttached;
|
||||
}
|
||||
|
||||
private void Marc_Plan_Load(object sender, EventArgs e)
|
||||
@@ -105,11 +107,13 @@ namespace WindowsFormsApp1.Mac
|
||||
for (int a = 0; a < ary.Length; a++)
|
||||
{
|
||||
if (a % 16 == 00) { Grid[00] = ary[a]; } // idx
|
||||
if (a % 16 == 01) { Grid[01] = ary[a];
|
||||
if (ary[a] == "") Grid[02] = tCnt.ToString();
|
||||
if (a % 16 == 01)
|
||||
{
|
||||
Grid[01] = ary[a];
|
||||
if (ary[a] == "") Grid[02] = tCnt.ToString();
|
||||
tCnt++;
|
||||
} // num
|
||||
if (a % 16 == 02) { Grid[02] = ary[a];} // r_num
|
||||
if (a % 16 == 02) { Grid[02] = ary[a]; } // r_num
|
||||
if (a % 16 == 03) { Grid[03] = ary[a]; } // class_symbol
|
||||
if (a % 16 == 04) { Grid[04] = ary[a]; } // author_symbol
|
||||
if (a % 16 == 05) { Grid[09] = ary[a]; } // ISBN
|
||||
@@ -122,7 +126,9 @@ namespace WindowsFormsApp1.Mac
|
||||
if (a % 16 == 12) { Grid[16] = ary[a]; } // book_comp
|
||||
if (a % 16 == 13) { Grid[17] = ary[a]; } // price
|
||||
if (a % 16 == 14) { Grid[18] = ary[a]; } // midx
|
||||
if (a % 16 == 15) { Grid[19] = ary[a]; // marc
|
||||
if (a % 16 == 15)
|
||||
{
|
||||
Grid[19] = ary[a]; // marc
|
||||
|
||||
string[] vcf = st.Take_Tag(ary[a], GetTag);
|
||||
Grid[5] = vcf[0];
|
||||
@@ -188,7 +194,8 @@ namespace WindowsFormsApp1.Mac
|
||||
|
||||
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
foreach (DataGridViewRow r in dataGridView1.Rows) {
|
||||
foreach (DataGridViewRow r in dataGridView1.Rows)
|
||||
{
|
||||
if (((CheckBox)sender).Checked)
|
||||
r.Cells["colCheck"].Value = "T";
|
||||
else
|
||||
@@ -203,7 +210,8 @@ namespace WindowsFormsApp1.Mac
|
||||
|
||||
if (row < 0) return;
|
||||
|
||||
if (dataGridView1.Rows[row].Cells[col].ReadOnly) {
|
||||
if (dataGridView1.Rows[row].Cells[col].ReadOnly)
|
||||
{
|
||||
string[] Marc = {
|
||||
dataGridView1.Rows[row].Cells["marc"].Value.ToString(),
|
||||
dataGridView1.Rows[row].Cells["midx"].Value.ToString(),
|
||||
@@ -252,7 +260,8 @@ namespace WindowsFormsApp1.Mac
|
||||
|
||||
private void tb_SearchTag_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.KeyCode == Keys.Enter) {
|
||||
if (e.KeyCode == Keys.Enter)
|
||||
{
|
||||
Search_Tag();
|
||||
}
|
||||
}
|
||||
@@ -268,7 +277,7 @@ namespace WindowsFormsApp1.Mac
|
||||
for (int a = 0; a < dataGridView1.Rows.Count; a++)
|
||||
{
|
||||
string marc = dataGridView1.Rows[a].Cells["marc"].Value.ToString();
|
||||
string[] tag = st.Take_Tag(marc, SearchTag,true);
|
||||
string[] tag = st.Take_Tag(marc, SearchTag, true);
|
||||
dataGridView1.Rows[a].Cells["search_tag2"].Value = tag[0];
|
||||
BackUpTag.Add(tag[0]);
|
||||
}
|
||||
@@ -295,10 +304,10 @@ namespace WindowsFormsApp1.Mac
|
||||
for (int a = 0; a < dataGridView1.Rows.Count; a++)
|
||||
{
|
||||
string Content = string.Empty;
|
||||
if(dataGridView1.Rows[a].Cells["search_tag2"].Value!=null)
|
||||
if (dataGridView1.Rows[a].Cells["search_tag2"].Value != null)
|
||||
Content = dataGridView1.Rows[a].Cells["search_tag2"].Value.ToString();
|
||||
else if(dataGridView1.Rows[a].Cells["search_tag2"].Value == null)
|
||||
Content = "delete";
|
||||
else if (dataGridView1.Rows[a].Cells["search_tag2"].Value == null)
|
||||
Content = "delete";
|
||||
if (Content == "") continue;
|
||||
string marc = dataGridView1.Rows[a].Cells["marc"].Value.ToString();
|
||||
string viewMarc = split_Marc(marc);
|
||||
@@ -318,7 +327,7 @@ namespace WindowsFormsApp1.Mac
|
||||
string newTag = string.Format("▼{0}{1}", TagName, Content);
|
||||
if (ConvertTag == 8)
|
||||
{
|
||||
oldTag = BackUpTag[a];
|
||||
oldTag = BackUpTag[a];
|
||||
newTag = Content;
|
||||
}
|
||||
// 해당 식별기호가 존재할 경우
|
||||
@@ -434,7 +443,7 @@ namespace WindowsFormsApp1.Mac
|
||||
private void btn_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
string table = "Specs_Marc";
|
||||
string[] Edit_Col = { "marc", "r_num", "class_symbol", "author_symbol", "prefix","price", "user", "editDate" };
|
||||
string[] Edit_Col = { "marc", "r_num", "class_symbol", "author_symbol", "prefix", "price", "user", "editDate" };
|
||||
string[] Where_Col = { "idx" };
|
||||
|
||||
for (int a = 0; a < dataGridView1.Rows.Count; a++)
|
||||
@@ -529,6 +538,7 @@ namespace WindowsFormsApp1.Mac
|
||||
default: break;
|
||||
}
|
||||
|
||||
string totalerrmsg = "";
|
||||
for (int a = 0; a < dataGridView1.Rows.Count; a++)
|
||||
{
|
||||
if (dataGridView1.Rows[a].Cells["marc"].Value.ToString() == "" &&
|
||||
@@ -538,13 +548,17 @@ namespace WindowsFormsApp1.Mac
|
||||
if (dataGridView1.Rows[a].Cells["colCheck"].Value.ToString() != "T")
|
||||
continue;
|
||||
|
||||
if (a == 825) Console.WriteLine("test");
|
||||
string marc = dataGridView1.Rows[a].Cells["Marc"].Value.ToString().Replace("₩", "\\");
|
||||
marc = st.ConvertMarcType(marc);
|
||||
marc = st.ConvertMarcType(marc, out string errmesage);
|
||||
marc = st.made_Ori_marc(marc, FileEncodingType);
|
||||
|
||||
Marc_data += marc;
|
||||
if (errmesage.isEmpty() == false) totalerrmsg += (totalerrmsg.isEmpty() ? "\n" : "") + errmesage;
|
||||
}
|
||||
|
||||
if (totalerrmsg.isEmpty() == false)
|
||||
UTIL.MsgI("경고 발생\n"+totalerrmsg);
|
||||
|
||||
string FileName;
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Title = "저장 경로를 지정하세요.";
|
||||
@@ -553,15 +567,18 @@ namespace WindowsFormsApp1.Mac
|
||||
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (FileEncodingType == "ANSI") {
|
||||
if (FileEncodingType == "ANSI")
|
||||
{
|
||||
FileName = saveFileDialog.FileName;
|
||||
System.IO.File.WriteAllText(FileName, Marc_data, Encoding.Default);
|
||||
}
|
||||
else if (FileEncodingType == "UTF-8") {
|
||||
else if (FileEncodingType == "UTF-8")
|
||||
{
|
||||
FileName = saveFileDialog.FileName;
|
||||
System.IO.File.WriteAllText(FileName, Marc_data, Encoding.UTF8);
|
||||
}
|
||||
else if (FileEncodingType == "UniCode") {
|
||||
else if (FileEncodingType == "UniCode")
|
||||
{
|
||||
FileName = saveFileDialog.FileName;
|
||||
System.IO.File.WriteAllText(FileName, Marc_data, Encoding.Unicode);
|
||||
}
|
||||
@@ -573,12 +590,17 @@ namespace WindowsFormsApp1.Mac
|
||||
private void btn_ApplyMacro_Click(object sender, EventArgs e)
|
||||
{
|
||||
Set_Macro sm = new Set_Macro(this, dataGridView1);
|
||||
sm.ViewMarcArray = Make_MarcArray();
|
||||
sm.ViewMarcArray = Make_MarcArray(out string errmessage);
|
||||
sm.Show();
|
||||
if(errmessage.isEmpty() == false)
|
||||
UTIL.MsgI("경고 발생\n" + errmessage);
|
||||
}
|
||||
private void btnTag040_Click(object sender, EventArgs e)
|
||||
{
|
||||
string[] tData = Make_MarcArray();
|
||||
string[] tData = Make_MarcArray(out string errmessage);
|
||||
if (errmessage.isEmpty() == false)
|
||||
UTIL.MsgI("경고 발생\n" + errmessage);
|
||||
|
||||
string tNewTagData = tbTag040.Text;
|
||||
List<string> tSplitMarc;
|
||||
for (int i = 0; i < tData.Length; i++)
|
||||
@@ -660,7 +682,7 @@ namespace WindowsFormsApp1.Mac
|
||||
tField.Add(data[a] + "▲");
|
||||
}
|
||||
tTag008IDX = tTagNum.FindIndex(x => x == "008");
|
||||
if (tTag008IDX == -1 ) continue;
|
||||
if (tTag008IDX == -1) continue;
|
||||
string tData = tField[tTag008IDX];
|
||||
List<string> tListData = tData.ToCharArray().ToList().ConvertAll(x => x.ToString());
|
||||
if (tListData.Count < 40) continue;
|
||||
@@ -676,9 +698,10 @@ namespace WindowsFormsApp1.Mac
|
||||
MessageBox.Show("태그 일괄 적용 완료!");
|
||||
|
||||
}
|
||||
|
||||
private string[] Make_MarcArray()
|
||||
|
||||
private string[] Make_MarcArray(out string totalerrmsg)
|
||||
{
|
||||
totalerrmsg = string.Empty;
|
||||
String_Text st = new String_Text();
|
||||
string[] MarcArray = new string[dataGridView1.RowCount];
|
||||
for (int a = 0; a < dataGridView1.Rows.Count; a++)
|
||||
@@ -691,8 +714,8 @@ namespace WindowsFormsApp1.Mac
|
||||
continue;
|
||||
|
||||
string marc = dataGridView1.Rows[a].Cells["Marc"].Value.ToString().Replace("₩", "\\");
|
||||
marc = st.ConvertMarcType(marc);
|
||||
|
||||
marc = st.ConvertMarcType(marc, out string errmesage);
|
||||
if (errmesage.isEmpty() == false) totalerrmsg += (totalerrmsg.isEmpty() ? "\n" : "") + errmesage;
|
||||
MarcArray[a] = marc;
|
||||
}
|
||||
return MarcArray;
|
||||
@@ -752,7 +775,7 @@ namespace WindowsFormsApp1.Mac
|
||||
int row = e.RowIndex;
|
||||
int col = dataGridView1.CurrentCell.ColumnIndex;
|
||||
|
||||
if (col == 2 || col == 3 || col == 4 || col == 5 || col == 6 || col == 7|| col==17)
|
||||
if (col == 2 || col == 3 || col == 4 || col == 5 || col == 6 || col == 7 || col == 17)
|
||||
{
|
||||
if (dataGridView1.Rows[row].Cells["num"].Value == null)
|
||||
{
|
||||
@@ -763,7 +786,7 @@ namespace WindowsFormsApp1.Mac
|
||||
{
|
||||
MessageBox.Show("저장된 마크가 없습니다!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (dataGridView1.Rows[row].Cells["marc"].Value.ToString() == "")
|
||||
{
|
||||
MessageBox.Show("저장된 마크가 없습니다!");
|
||||
@@ -786,24 +809,26 @@ namespace WindowsFormsApp1.Mac
|
||||
string C = dataGridView1.Rows[row].Cells[6].Value.ToString();
|
||||
string F = dataGridView1.Rows[row].Cells[7].Value.ToString();
|
||||
|
||||
if (L != "")
|
||||
L = string.Format("▼l{0}", L);
|
||||
if (L != "")
|
||||
L = string.Format("▼l{0}", L);
|
||||
|
||||
if (V != "")
|
||||
V = string.Format("▼v{0}", V);
|
||||
if (V != "")
|
||||
V = string.Format("▼v{0}", V);
|
||||
|
||||
if (C != "")
|
||||
C = string.Format("▼c{0}", C);
|
||||
if (C != "")
|
||||
C = string.Format("▼c{0}", C);
|
||||
|
||||
if (F != "")
|
||||
F = string.Format("▼f{0}", F);
|
||||
if (F != "")
|
||||
F = string.Format("▼f{0}", F);
|
||||
|
||||
AddTag = string.Format("049\t \t{0}{1}{2}{3}▲", L, V, C, F);
|
||||
AddTag = string.Format("049\t \t{0}{1}{2}{3}▲", L, V, C, F);
|
||||
|
||||
if (L == "" && V == "" && C == "" && F == "") {
|
||||
if (L == "" && V == "" && C == "" && F == "")
|
||||
{
|
||||
TypeView = st.RemoveTagNumber(TypeView, "049");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
TypeView = AddTagInMarc(AddTag, TypeView);
|
||||
}
|
||||
}
|
||||
@@ -817,7 +842,8 @@ namespace WindowsFormsApp1.Mac
|
||||
string B = dataGridView1.Rows[row].Cells[4].Value.ToString();
|
||||
string V = dataGridView1.Rows[row].Cells[5].Value.ToString();
|
||||
|
||||
if (A != "") {
|
||||
if (A != "")
|
||||
{
|
||||
A = string.Format("▼a{0}", A);
|
||||
TypeView = st.ChangeTagInMarc("056a", A, TypeView);
|
||||
}
|
||||
@@ -830,10 +856,12 @@ namespace WindowsFormsApp1.Mac
|
||||
|
||||
AddTag = string.Format("090\t \t{0}{1}{2}▲", A, B, V);
|
||||
|
||||
if (A == "" && B == "" && V == "") {
|
||||
if (A == "" && B == "" && V == "")
|
||||
{
|
||||
TypeView = st.RemoveTagNumber(TypeView, "090");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
TypeView = AddTagInMarc(AddTag, TypeView);
|
||||
}
|
||||
}
|
||||
@@ -876,7 +904,7 @@ namespace WindowsFormsApp1.Mac
|
||||
|
||||
List<string> TagNum = new List<string>(); // 태그번호 저장용
|
||||
List<string> Field = new List<string>(); // 가변길이필드 저장용
|
||||
|
||||
|
||||
// 특수기호 육안으로 확인하기 쉽게 변환
|
||||
Marc = Marc.Replace("", "▼");
|
||||
Marc = Marc.Replace("", "▲");
|
||||
@@ -1016,7 +1044,7 @@ namespace WindowsFormsApp1.Mac
|
||||
int startCount = Convert.ToInt32(tb_StartPosition.Text);
|
||||
if (isMorePage)
|
||||
startCount = 0;
|
||||
|
||||
|
||||
int GridCount = 0;
|
||||
for (int SeroCount = 0; SeroCount < Sero; SeroCount++)
|
||||
{
|
||||
@@ -1035,7 +1063,7 @@ namespace WindowsFormsApp1.Mac
|
||||
UxPos += mmToInch(8);
|
||||
|
||||
e.Graphics.DrawString(GridData[Cnt], F, Brushes.Black, UxPos + mmToInch(6), yPos + mmToInch(2), format);
|
||||
|
||||
|
||||
if (!chk_Num.Checked)
|
||||
e.Graphics.DrawString(
|
||||
dataGridView1.Rows[Cnt].Cells["reg_num"].Value.ToString(),
|
||||
@@ -1233,7 +1261,8 @@ namespace WindowsFormsApp1.Mac
|
||||
|
||||
for (int b = 0; b < CheckList.GetLength(0); b++)
|
||||
{
|
||||
if (WorkFix.IndexOf(CheckList[b, 0]) > -1) {
|
||||
if (WorkFix.IndexOf(CheckList[b, 0]) > -1)
|
||||
{
|
||||
dataGridView1.Rows[a].Cells[col].Style.BackColor = ColorList[Convert.ToInt32(CheckList[b, 1])];
|
||||
break;
|
||||
}
|
||||
@@ -1358,7 +1387,8 @@ namespace WindowsFormsApp1.Mac
|
||||
{
|
||||
if (t == "") continue;
|
||||
|
||||
if (Target.IndexOf(t.TrimStart().TrimEnd()) > -1) {
|
||||
if (Target.IndexOf(t.TrimStart().TrimEnd()) > -1)
|
||||
{
|
||||
dataGridView1.Rows[a].Cells["search_tag2"].Style.BackColor = Color.Yellow;
|
||||
break;
|
||||
}
|
||||
@@ -1370,5 +1400,82 @@ namespace WindowsFormsApp1.Mac
|
||||
{
|
||||
mk_Grid(btn_Select_List.Text, this.date);
|
||||
}
|
||||
|
||||
private void toolStripButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 범위 입력받기
|
||||
string input = Microsoft.VisualBasic.Interaction.InputBox(
|
||||
"삭제할 행 범위를 입력하세요.\n예) 1~100 (1번부터 100번까지 삭제)",
|
||||
"행 범위 삭제",
|
||||
"",
|
||||
-1, -1);
|
||||
|
||||
// 취소 또는 빈 입력
|
||||
if (string.IsNullOrWhiteSpace(input))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
// "1~100" 형식 파싱
|
||||
string[] parts = input.Split('~', '-');
|
||||
if (parts.Length != 2)
|
||||
{
|
||||
MessageBox.Show("올바른 형식으로 입력해주세요.\n예) 1~100", "입력 오류", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
int startRow = int.Parse(parts[0].Trim());
|
||||
int endRow = int.Parse(parts[1].Trim());
|
||||
|
||||
// 범위 검증
|
||||
if (startRow < 1 || endRow < 1)
|
||||
{
|
||||
MessageBox.Show("행 번호는 1 이상이어야 합니다.", "입력 오류", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (startRow > endRow)
|
||||
{
|
||||
MessageBox.Show("시작 행 번호가 끝 행 번호보다 클 수 없습니다.", "입력 오류", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// 사용자 입력은 1부터 시작하지만, 인덱스는 0부터 시작하므로 -1
|
||||
int startIndex = startRow - 1;
|
||||
int endIndex = endRow - 1;
|
||||
|
||||
// 범위가 그리드 범위를 벗어나는지 확인
|
||||
if (endIndex >= dataGridView1.Rows.Count)
|
||||
{
|
||||
MessageBox.Show($"입력한 범위가 전체 행 수({dataGridView1.Rows.Count})를 초과합니다.", "입력 오류", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
// 삭제 확인
|
||||
string confirmMsg = string.Format("{0}번부터 {1}번까지 총 {2}개의 행을 삭제하시겠습니까?",
|
||||
startRow, endRow, endRow - startRow + 1);
|
||||
if (MessageBox.Show(confirmMsg, "행 삭제 확인", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
|
||||
return;
|
||||
|
||||
// 뒤에서부터 삭제 (인덱스가 꼬이지 않도록)
|
||||
for (int i = endIndex; i >= startIndex; i--)
|
||||
{
|
||||
if (i < dataGridView1.Rows.Count && !dataGridView1.Rows[i].IsNewRow)
|
||||
{
|
||||
dataGridView1.Rows.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.Show("삭제가 완료되었습니다.", "완료", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
MessageBox.Show("숫자 형식으로 입력해주세요.\n예) 1~100", "입력 오류", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"삭제 중 오류가 발생했습니다.\n{ex.Message}", "오류", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,13 +120,31 @@
|
||||
<metadata name="search_tag2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>300, 6</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIFSURBVDhPpZLtS1NhGMbPPxJmmlYSgqHiKzGU1EDxg4iK
|
||||
YKyG2WBogqMYJQOtCEVRFBGdTBCJfRnkS4VaaWNT5sqx1BUxRXxDHYxAJLvkusEeBaPAB+5z4Jzn+t3X
|
||||
/aLhnEfjo8m+dCoa+7/C3O2Hqe0zDC+8KG+cRZHZhdzaaWTVTCLDMIY0vfM04Nfh77/G/sEhwpEDbO3t
|
||||
I7TxE8urEVy99fT/AL5gWDLrTB/hnF4XsW0khCu5ln8DmJliT2AXrcNBsU1gj/MH4nMeKwBrPktM28xM
|
||||
cX79DFKrHHD5d9D26hvicx4pABt2lpg10zYzU0zr7+e3xXGcrkEB2O2TNec9nJFwB3alZn5jZorfeDZh
|
||||
6Q3g8s06BeCoKF4MRURoH1+BY2oNCbeb0TIclIYxOhzf8frTOuo7FxCbbVIAzpni0iceEc8vhzEwGkJD
|
||||
lx83ymxifejdKjRNk/8PWnyIyTQqAJek0jqHwfEVscu31baIu8+90sTE4nY025dQ2/5FIPpnXlzKuK8A
|
||||
HBUzHot52djqQ6HZhfR7IwK4mKpHtvEDMqvfCiQ6zaAAXM8x94aIWTNrLLG4kVUzgaTSPlzLtyJOZxbb
|
||||
1wtfyg4Q+AfA3aZlButjSfxGcUJBk4g5tuP3haQKRKXcUQDOmbvNTpPOJeFFjordZmbWTNvMTHFUcpUC
|
||||
nOccAdABIDXXE1nzAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="printDocument1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>6, 7</value>
|
||||
</metadata>
|
||||
<metadata name="printPreviewDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>138, 6</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="printPreviewDialog1.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAYAICAQAAAAAADoAgAAZgAAABAQEAAAAAAAKAEAAE4DAAAgIAAAAQAIAKgIAAB2BAAAEBAAAAEA
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace UniMarc.마크
|
||||
if (Author_res[3].IndexOf("[외]") > -1)
|
||||
Author[0] = Marc[5];
|
||||
|
||||
string tmp_ViewMarc = st.ConvertMarcType(insert_marc_data[14]);
|
||||
string tmp_ViewMarc = st.ConvertMarcType(insert_marc_data[14],out string errmessage);
|
||||
|
||||
// 마크에서 추출한 데이터 DB에 적용하기 위한 반복문
|
||||
for (int b = 0; b < Marc.Length; b++)
|
||||
|
||||
@@ -162,11 +162,11 @@ namespace WindowsFormsApp1.Mac
|
||||
int count = 0;
|
||||
for (int a = 0; a < TargetGrid.Rows.Count; a++)
|
||||
{
|
||||
if (TargetGrid.Rows[a].Cells["marc"].Value.ToString() == "" &&
|
||||
TargetGrid.Rows[a].Cells["marc"].Value == null)
|
||||
var marcstring = TargetGrid.Rows[a].Cells["marc"].Value?.ToString() ?? string.Empty;
|
||||
if (string.IsNullOrEmpty(marcstring))
|
||||
continue;
|
||||
|
||||
if (TargetGrid.Rows[a].Cells["colCheck"].Value.ToString() != "T")
|
||||
if ((TargetGrid.Rows[a].Cells["colCheck"].Value?.ToString() ?? string.Empty) != "T")
|
||||
continue;
|
||||
|
||||
TargetGrid.Rows[a].Cells["marc"].Value = macro.MacroMarc(ViewMarcArray[count], tMacroList);
|
||||
|
||||
174
unimarc/unimarc/홈/Transaction_manage.Designer.cs
generated
174
unimarc/unimarc/홈/Transaction_manage.Designer.cs
generated
@@ -77,6 +77,8 @@
|
||||
this.label = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.program = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.bigo = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.btExportList = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tb_man1 = new System.Windows.Forms.TextBox();
|
||||
this.btn_search = new System.Windows.Forms.Button();
|
||||
this.tb_id = new System.Windows.Forms.TextBox();
|
||||
@@ -133,9 +135,16 @@
|
||||
this.panel7 = new System.Windows.Forms.Panel();
|
||||
this.panel6 = new System.Windows.Forms.Panel();
|
||||
this.panel5 = new System.Windows.Forms.Panel();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.btExportList = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.panel9 = new System.Windows.Forms.Panel();
|
||||
this.cb_authorType = new System.Windows.Forms.ComboBox();
|
||||
this.cb_divType = new System.Windows.Forms.ComboBox();
|
||||
this.cb_divNum = new System.Windows.Forms.ComboBox();
|
||||
this.cb_FirstBook = new System.Windows.Forms.ComboBox();
|
||||
this.cb_FirstAuthor = new System.Windows.Forms.ComboBox();
|
||||
this.label20 = new System.Windows.Forms.Label();
|
||||
this.label21 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dv1)).BeginInit();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
this.panel2.SuspendLayout();
|
||||
@@ -147,7 +156,7 @@
|
||||
this.panel7.SuspendLayout();
|
||||
this.panel6.SuspendLayout();
|
||||
this.panel5.SuspendLayout();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.panel9.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// NameLabel
|
||||
@@ -379,13 +388,16 @@
|
||||
// idx
|
||||
//
|
||||
this.idx.HeaderText = "idx";
|
||||
this.idx.MinimumWidth = 6;
|
||||
this.idx.Name = "idx";
|
||||
this.idx.ReadOnly = true;
|
||||
this.idx.Visible = false;
|
||||
this.idx.Width = 125;
|
||||
//
|
||||
// sangho
|
||||
//
|
||||
this.sangho.HeaderText = "업체명";
|
||||
this.sangho.MinimumWidth = 6;
|
||||
this.sangho.Name = "sangho";
|
||||
this.sangho.ReadOnly = true;
|
||||
this.sangho.Width = 150;
|
||||
@@ -393,6 +405,7 @@
|
||||
// gubun
|
||||
//
|
||||
this.gubun.HeaderText = "구분";
|
||||
this.gubun.MinimumWidth = 6;
|
||||
this.gubun.Name = "gubun";
|
||||
this.gubun.ReadOnly = true;
|
||||
this.gubun.Width = 80;
|
||||
@@ -400,48 +413,63 @@
|
||||
// boss
|
||||
//
|
||||
this.boss.HeaderText = "대표자명";
|
||||
this.boss.MinimumWidth = 6;
|
||||
this.boss.Name = "boss";
|
||||
this.boss.ReadOnly = true;
|
||||
this.boss.Width = 125;
|
||||
//
|
||||
// bubin
|
||||
//
|
||||
this.bubin.HeaderText = "등록번호";
|
||||
this.bubin.MinimumWidth = 6;
|
||||
this.bubin.Name = "bubin";
|
||||
this.bubin.ReadOnly = true;
|
||||
this.bubin.Width = 125;
|
||||
//
|
||||
// uptae
|
||||
//
|
||||
this.uptae.HeaderText = "업태";
|
||||
this.uptae.MinimumWidth = 6;
|
||||
this.uptae.Name = "uptae";
|
||||
this.uptae.ReadOnly = true;
|
||||
this.uptae.Width = 125;
|
||||
//
|
||||
// jongmok
|
||||
//
|
||||
this.jongmok.HeaderText = "종목";
|
||||
this.jongmok.MinimumWidth = 6;
|
||||
this.jongmok.Name = "jongmok";
|
||||
this.jongmok.ReadOnly = true;
|
||||
this.jongmok.Width = 125;
|
||||
//
|
||||
// tel
|
||||
//
|
||||
this.tel.HeaderText = "전화번호";
|
||||
this.tel.MinimumWidth = 6;
|
||||
this.tel.Name = "tel";
|
||||
this.tel.ReadOnly = true;
|
||||
this.tel.Width = 125;
|
||||
//
|
||||
// fax
|
||||
//
|
||||
this.fax.HeaderText = "팩스";
|
||||
this.fax.MinimumWidth = 6;
|
||||
this.fax.Name = "fax";
|
||||
this.fax.ReadOnly = true;
|
||||
this.fax.Width = 125;
|
||||
//
|
||||
// mail
|
||||
//
|
||||
this.mail.HeaderText = "메일";
|
||||
this.mail.MinimumWidth = 6;
|
||||
this.mail.Name = "mail";
|
||||
this.mail.ReadOnly = true;
|
||||
this.mail.Width = 125;
|
||||
//
|
||||
// man
|
||||
//
|
||||
this.man.HeaderText = "담당자";
|
||||
this.man.MinimumWidth = 6;
|
||||
this.man.Name = "man";
|
||||
this.man.ReadOnly = true;
|
||||
this.man.Width = 80;
|
||||
@@ -449,6 +477,7 @@
|
||||
// mantel
|
||||
//
|
||||
this.mantel.HeaderText = "담당자 정보";
|
||||
this.mantel.MinimumWidth = 6;
|
||||
this.mantel.Name = "mantel";
|
||||
this.mantel.ReadOnly = true;
|
||||
this.mantel.Width = 160;
|
||||
@@ -456,18 +485,23 @@
|
||||
// assumer
|
||||
//
|
||||
this.assumer.HeaderText = "담당직원";
|
||||
this.assumer.MinimumWidth = 6;
|
||||
this.assumer.Name = "assumer";
|
||||
this.assumer.ReadOnly = true;
|
||||
this.assumer.Width = 125;
|
||||
//
|
||||
// post_num
|
||||
//
|
||||
this.post_num.HeaderText = "우편번호";
|
||||
this.post_num.MinimumWidth = 6;
|
||||
this.post_num.Name = "post_num";
|
||||
this.post_num.ReadOnly = true;
|
||||
this.post_num.Width = 125;
|
||||
//
|
||||
// addr
|
||||
//
|
||||
this.addr.HeaderText = "주소";
|
||||
this.addr.MinimumWidth = 6;
|
||||
this.addr.Name = "addr";
|
||||
this.addr.ReadOnly = true;
|
||||
this.addr.Width = 200;
|
||||
@@ -475,45 +509,74 @@
|
||||
// dlsArea
|
||||
//
|
||||
this.dlsArea.HeaderText = "DLS지역";
|
||||
this.dlsArea.MinimumWidth = 6;
|
||||
this.dlsArea.Name = "dlsArea";
|
||||
this.dlsArea.ReadOnly = true;
|
||||
this.dlsArea.Width = 125;
|
||||
//
|
||||
// DLSid
|
||||
//
|
||||
this.DLSid.HeaderText = "아이디";
|
||||
this.DLSid.MinimumWidth = 6;
|
||||
this.DLSid.Name = "DLSid";
|
||||
this.DLSid.ReadOnly = true;
|
||||
this.DLSid.Width = 125;
|
||||
//
|
||||
// DLSpw
|
||||
//
|
||||
this.DLSpw.HeaderText = "비밀번호";
|
||||
this.DLSpw.MinimumWidth = 6;
|
||||
this.DLSpw.Name = "DLSpw";
|
||||
this.DLSpw.ReadOnly = true;
|
||||
this.DLSpw.Width = 125;
|
||||
//
|
||||
// division
|
||||
//
|
||||
this.division.HeaderText = "용지칸수";
|
||||
this.division.MinimumWidth = 6;
|
||||
this.division.Name = "division";
|
||||
this.division.ReadOnly = true;
|
||||
this.division.Width = 125;
|
||||
//
|
||||
// label
|
||||
//
|
||||
this.label.HeaderText = "띠라벨";
|
||||
this.label.MinimumWidth = 6;
|
||||
this.label.Name = "label";
|
||||
this.label.ReadOnly = true;
|
||||
this.label.Width = 125;
|
||||
//
|
||||
// program
|
||||
//
|
||||
this.program.HeaderText = "사용프로그램";
|
||||
this.program.MinimumWidth = 6;
|
||||
this.program.Name = "program";
|
||||
this.program.ReadOnly = true;
|
||||
this.program.Width = 125;
|
||||
//
|
||||
// bigo
|
||||
//
|
||||
this.bigo.HeaderText = "비고";
|
||||
this.bigo.MinimumWidth = 6;
|
||||
this.bigo.Name = "bigo";
|
||||
this.bigo.ReadOnly = true;
|
||||
this.bigo.Visible = false;
|
||||
this.bigo.Width = 125;
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btExportList});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(151, 26);
|
||||
//
|
||||
// btExportList
|
||||
//
|
||||
this.btExportList.Name = "btExportList";
|
||||
this.btExportList.Size = new System.Drawing.Size(150, 22);
|
||||
this.btExportList.Text = "목록 내보내기";
|
||||
this.btExportList.Click += new System.EventHandler(this.btExportList_Click);
|
||||
//
|
||||
// tb_man1
|
||||
//
|
||||
@@ -744,7 +807,7 @@
|
||||
//
|
||||
this.btn_marc_expand.Location = new System.Drawing.Point(852, 50);
|
||||
this.btn_marc_expand.Name = "btn_marc_expand";
|
||||
this.btn_marc_expand.Size = new System.Drawing.Size(75, 355);
|
||||
this.btn_marc_expand.Size = new System.Drawing.Size(101, 65);
|
||||
this.btn_marc_expand.TabIndex = 46;
|
||||
this.btn_marc_expand.Text = "마크 비고 >>";
|
||||
this.btn_marc_expand.UseVisualStyleBackColor = true;
|
||||
@@ -772,6 +835,7 @@
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
this.panel2.Controls.Add(this.panel9);
|
||||
this.panel2.Controls.Add(this.tableLayoutPanel1);
|
||||
this.panel2.Controls.Add(this.lbl_idx);
|
||||
this.panel2.Controls.Add(this.NameLabel);
|
||||
@@ -946,12 +1010,14 @@
|
||||
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.Column1.DefaultCellStyle = dataGridViewCellStyle4;
|
||||
this.Column1.HeaderText = "내용";
|
||||
this.Column1.MinimumWidth = 6;
|
||||
this.Column1.Name = "Column1";
|
||||
this.Column1.Width = 150;
|
||||
//
|
||||
// Column2
|
||||
//
|
||||
this.Column2.HeaderText = "내용";
|
||||
this.Column2.MinimumWidth = 6;
|
||||
this.Column2.Name = "Column2";
|
||||
this.Column2.Width = 450;
|
||||
//
|
||||
@@ -960,6 +1026,7 @@
|
||||
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.Column3.DefaultCellStyle = dataGridViewCellStyle5;
|
||||
this.Column3.HeaderText = "내용";
|
||||
this.Column3.MinimumWidth = 6;
|
||||
this.Column3.Name = "Column3";
|
||||
this.Column3.Width = 150;
|
||||
//
|
||||
@@ -1017,12 +1084,14 @@
|
||||
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.dataGridViewTextBoxColumn1.DefaultCellStyle = dataGridViewCellStyle7;
|
||||
this.dataGridViewTextBoxColumn1.HeaderText = "내용";
|
||||
this.dataGridViewTextBoxColumn1.MinimumWidth = 6;
|
||||
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
|
||||
this.dataGridViewTextBoxColumn1.Width = 150;
|
||||
//
|
||||
// dataGridViewTextBoxColumn2
|
||||
//
|
||||
this.dataGridViewTextBoxColumn2.HeaderText = "내용";
|
||||
this.dataGridViewTextBoxColumn2.MinimumWidth = 6;
|
||||
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
|
||||
this.dataGridViewTextBoxColumn2.Width = 450;
|
||||
//
|
||||
@@ -1031,6 +1100,7 @@
|
||||
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
|
||||
this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle8;
|
||||
this.dataGridViewTextBoxColumn3.HeaderText = "내용";
|
||||
this.dataGridViewTextBoxColumn3.MinimumWidth = 6;
|
||||
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
|
||||
this.dataGridViewTextBoxColumn3.Width = 150;
|
||||
//
|
||||
@@ -1117,19 +1187,83 @@
|
||||
this.panel5.Size = new System.Drawing.Size(830, 35);
|
||||
this.panel5.TabIndex = 51;
|
||||
//
|
||||
// contextMenuStrip1
|
||||
// panel9
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btExportList});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(181, 48);
|
||||
this.panel9.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panel9.Controls.Add(this.cb_authorType);
|
||||
this.panel9.Controls.Add(this.cb_divType);
|
||||
this.panel9.Controls.Add(this.cb_divNum);
|
||||
this.panel9.Controls.Add(this.cb_FirstBook);
|
||||
this.panel9.Controls.Add(this.cb_FirstAuthor);
|
||||
this.panel9.Controls.Add(this.label20);
|
||||
this.panel9.Controls.Add(this.label21);
|
||||
this.panel9.Location = new System.Drawing.Point(844, 124);
|
||||
this.panel9.Name = "panel9";
|
||||
this.panel9.Size = new System.Drawing.Size(118, 174);
|
||||
this.panel9.TabIndex = 45;
|
||||
//
|
||||
// btExportList
|
||||
// cb_authorType
|
||||
//
|
||||
this.btExportList.Name = "btExportList";
|
||||
this.btExportList.Size = new System.Drawing.Size(180, 22);
|
||||
this.btExportList.Text = "목록 내보내기";
|
||||
this.btExportList.Click += new System.EventHandler(this.btExportList_Click);
|
||||
this.cb_authorType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cb_authorType.FormattingEnabled = true;
|
||||
this.cb_authorType.Location = new System.Drawing.Point(4, 50);
|
||||
this.cb_authorType.Name = "cb_authorType";
|
||||
this.cb_authorType.Size = new System.Drawing.Size(104, 20);
|
||||
this.cb_authorType.TabIndex = 1;
|
||||
//
|
||||
// cb_divType
|
||||
//
|
||||
this.cb_divType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cb_divType.FormattingEnabled = true;
|
||||
this.cb_divType.Location = new System.Drawing.Point(4, 119);
|
||||
this.cb_divType.Name = "cb_divType";
|
||||
this.cb_divType.Size = new System.Drawing.Size(104, 20);
|
||||
this.cb_divType.TabIndex = 1;
|
||||
//
|
||||
// cb_divNum
|
||||
//
|
||||
this.cb_divNum.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cb_divNum.FormattingEnabled = true;
|
||||
this.cb_divNum.Location = new System.Drawing.Point(4, 145);
|
||||
this.cb_divNum.Name = "cb_divNum";
|
||||
this.cb_divNum.Size = new System.Drawing.Size(104, 20);
|
||||
this.cb_divNum.TabIndex = 1;
|
||||
//
|
||||
// cb_FirstBook
|
||||
//
|
||||
this.cb_FirstBook.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cb_FirstBook.FormattingEnabled = true;
|
||||
this.cb_FirstBook.Location = new System.Drawing.Point(4, 74);
|
||||
this.cb_FirstBook.Name = "cb_FirstBook";
|
||||
this.cb_FirstBook.Size = new System.Drawing.Size(104, 20);
|
||||
this.cb_FirstBook.TabIndex = 1;
|
||||
//
|
||||
// cb_FirstAuthor
|
||||
//
|
||||
this.cb_FirstAuthor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cb_FirstAuthor.FormattingEnabled = true;
|
||||
this.cb_FirstAuthor.Location = new System.Drawing.Point(4, 24);
|
||||
this.cb_FirstAuthor.Name = "cb_FirstAuthor";
|
||||
this.cb_FirstAuthor.Size = new System.Drawing.Size(104, 20);
|
||||
this.cb_FirstAuthor.TabIndex = 1;
|
||||
//
|
||||
// label20
|
||||
//
|
||||
this.label20.AutoSize = true;
|
||||
this.label20.Location = new System.Drawing.Point(2, 104);
|
||||
this.label20.Name = "label20";
|
||||
this.label20.Size = new System.Drawing.Size(29, 12);
|
||||
this.label20.TabIndex = 1;
|
||||
this.label20.Text = "구분";
|
||||
//
|
||||
// label21
|
||||
//
|
||||
this.label21.AutoSize = true;
|
||||
this.label21.Location = new System.Drawing.Point(2, 7);
|
||||
this.label21.Name = "label21";
|
||||
this.label21.Size = new System.Drawing.Size(53, 12);
|
||||
this.label21.TabIndex = 1;
|
||||
this.label21.Text = "저자기호";
|
||||
//
|
||||
// Transaction_manage
|
||||
//
|
||||
@@ -1142,6 +1276,7 @@
|
||||
this.Text = "납품 / 거래처 관리";
|
||||
this.Load += new System.EventHandler(this.Transaction_manage_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dv1)).EndInit();
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel3.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
@@ -1157,7 +1292,8 @@
|
||||
this.panel6.ResumeLayout(false);
|
||||
this.panel5.ResumeLayout(false);
|
||||
this.panel5.PerformLayout();
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.panel9.ResumeLayout(false);
|
||||
this.panel9.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -1262,5 +1398,13 @@
|
||||
private System.Windows.Forms.Button btnInit;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem btExportList;
|
||||
private System.Windows.Forms.Panel panel9;
|
||||
private System.Windows.Forms.ComboBox cb_authorType;
|
||||
private System.Windows.Forms.ComboBox cb_divType;
|
||||
private System.Windows.Forms.ComboBox cb_divNum;
|
||||
private System.Windows.Forms.ComboBox cb_FirstBook;
|
||||
private System.Windows.Forms.ComboBox cb_FirstAuthor;
|
||||
private System.Windows.Forms.Label label20;
|
||||
private System.Windows.Forms.Label label21;
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,27 @@ namespace WindowsFormsApp1.Home
|
||||
compidx = main.com_idx;
|
||||
panel4.Visible = false;
|
||||
db.DBcon();
|
||||
|
||||
//저자기호 셋팅값 251022
|
||||
AuthorSymbol.Symbol sb = new AuthorSymbol.Symbol();
|
||||
cb_FirstAuthor.Items.AddRange(sb.authorBook);
|
||||
cb_authorType.Items.AddRange(sb.authorType);
|
||||
cb_FirstBook.Items.AddRange(sb.authorFirst);
|
||||
|
||||
string[] divType = { "KDC", "DDC" };
|
||||
cb_divType.Items.AddRange(divType);
|
||||
|
||||
string[] divNum = { "4", "5", "6" };
|
||||
cb_divNum.Items.AddRange(divNum);
|
||||
|
||||
//저자기호 관련 컬럼추가
|
||||
dv1.Columns.Add(new DataGridViewTextBoxColumn() { Name = "dvc_author_first", HeaderText = "dvc_author_first", Visible = false });
|
||||
dv1.Columns.Add(new DataGridViewTextBoxColumn() { Name = "dvc_author_type", HeaderText = "dvc_author_type", Visible = false });
|
||||
dv1.Columns.Add(new DataGridViewTextBoxColumn() { Name = "dvc_author_firstbook", HeaderText = "dvc_author_firstbook", Visible = false });
|
||||
dv1.Columns.Add(new DataGridViewTextBoxColumn() { Name = "dvc_author_divtype", HeaderText = "dvc_author_divtype", Visible = false });
|
||||
dv1.Columns.Add(new DataGridViewTextBoxColumn() { Name = "dvc_author_divnum", HeaderText = "dvc_author_divnum", Visible = false });
|
||||
|
||||
|
||||
}
|
||||
private void Made_Grid()
|
||||
{
|
||||
@@ -47,7 +68,7 @@ namespace WindowsFormsApp1.Home
|
||||
"`c_uptae`, `c_jongmok`, `c_tel`, `c_fax`, `c_email`, " +
|
||||
"`c_man`, `c_mantel`, `c_user`, `c_zip`, `c_addr`, " +
|
||||
"`c_dlsArea`, `c_dlsID`, `c_dlsPW`, `c_division`, `c_label`, " +
|
||||
"`c_program`, `c_etc`";
|
||||
"`c_program`, `c_etc`";//, `c_author_first`, `c_author_type`, `c_author_firstbook`, `c_author_divtype`, `c_author_divnum`";
|
||||
string cmd = db.DB_Select_Search(seartempdb, "Client", "campanyidx", compidx);
|
||||
string db_res = db.DB_Send_CMD_Search(cmd);
|
||||
dv1.Rows.Clear();
|
||||
@@ -106,6 +127,11 @@ namespace WindowsFormsApp1.Home
|
||||
tb_program.Text = "";
|
||||
rtb_etc.Text = "";
|
||||
cb_gubun1.SelectedIndex = 0;
|
||||
cb_authorType.SelectedIndex = -1;
|
||||
cb_FirstAuthor.SelectedIndex = -1;
|
||||
cb_FirstBook.SelectedIndex = -1;
|
||||
cb_divNum.SelectedIndex = -1;
|
||||
cb_divType.SelectedIndex = -1;
|
||||
}
|
||||
private bool Check_Data(string pText)
|
||||
{
|
||||
@@ -162,13 +188,14 @@ namespace WindowsFormsApp1.Home
|
||||
"c_jongmok", "c_tel", "c_fax", "c_email", "c_man",
|
||||
"c_mantel", "c_user", "c_zip", "c_addr", "c_dlsID",
|
||||
"c_dlsPW", "c_division", "c_label", "c_program", "c_etc",
|
||||
"campanyidx", "c_dlsArea" };
|
||||
"campanyidx", "c_dlsArea" ,
|
||||
"c_author_first", "c_author_type", "c_author_firstbook", "c_author_divtype", "c_author_divnum"};
|
||||
|
||||
string[] tmpdb1 = { tb_sangho.Text, cb_gubun2.Text, tb_boss.Text, tb_bubin.Text, tb_uptae.Text,
|
||||
tb_jongmok.Text, tb_tel.Text, tb_fax.Text, tb_mail.Text, tb_man.Text,
|
||||
tb_man1.Text, tb_user.Text, tb_zip.Text, tb_addr.Text, tb_id.Text,
|
||||
tb_pw.Text, tb_division.Text, tb_label.Text, tb_program.Text, rtb_etc.Text,
|
||||
compidx, cb_dlsArea.Text };
|
||||
compidx, cb_dlsArea.Text, cb_FirstAuthor.Text, cb_authorType.Text, cb_FirstBook.Text, cb_divType.Text, cb_divNum.Text };
|
||||
string[] tOldData = {
|
||||
};
|
||||
string Incmd = db.DB_INSERT("Client", tmpdb, tmpdb1);
|
||||
@@ -221,13 +248,15 @@ namespace WindowsFormsApp1.Home
|
||||
"c_jongmok", "c_tel", "c_fax", "c_email", "c_man",
|
||||
"c_mantel", "c_user", "c_zip", "c_addr", "c_dlsID",
|
||||
"c_dlsPW", "c_division", "c_label", "c_program", "c_etc",
|
||||
"c_dlsArea" };
|
||||
"c_dlsArea" ,
|
||||
"c_author_first", "c_author_type", "c_author_firstbook", "c_author_divtype", "c_author_divnum"};
|
||||
|
||||
string[] editname = { tb_sangho.Text, cb_gubun2.Text, tb_boss.Text, tb_bubin.Text, tb_uptae.Text,
|
||||
tb_jongmok.Text, tb_tel.Text, tb_fax.Text, tb_mail.Text, tb_man.Text,
|
||||
tb_man1.Text, tb_user.Text, tb_zip.Text, tb_addr.Text, tb_id.Text,
|
||||
tb_pw.Text, tb_division.Text, tb_label.Text, tb_program.Text, rtb_etc.Text,
|
||||
cb_dlsArea.Text };
|
||||
cb_dlsArea.Text,
|
||||
cb_FirstAuthor.Text, cb_authorType.Text, cb_FirstBook.Text, cb_divType.Text, cb_divNum.Text };
|
||||
|
||||
string[] searchcol = { "idx", "campanyidx" };
|
||||
string[] searchname = { lbl_idx.Text, compidx };
|
||||
@@ -315,9 +344,27 @@ namespace WindowsFormsApp1.Home
|
||||
tb_tel.Text = dv1.Rows[RowIndex].Cells["tel"].Value.ToString();
|
||||
tb_fax.Text = dv1.Rows[RowIndex].Cells["fax"].Value.ToString();
|
||||
tb_addr.Text = dv1.Rows[RowIndex].Cells["addr"].Value.ToString();
|
||||
|
||||
rtb_etc.Text = dv1.Rows[RowIndex].Cells["bigo"].Value.ToString();
|
||||
cb_dlsArea.Text = dv1.Rows[RowIndex].Cells["dlsArea"].Value.ToString();
|
||||
|
||||
//저자기호값 셋팅
|
||||
var author_first = dv1.Rows[RowIndex].Cells["dvc_author_first"].Value?.ToString() ?? string.Empty;
|
||||
var author_type = dv1.Rows[RowIndex].Cells["dvc_author_type"].Value?.ToString() ?? string.Empty;
|
||||
var author_firstbook = dv1.Rows[RowIndex].Cells["dvc_author_firstbook"].Value?.ToString() ?? string.Empty;
|
||||
var author_divtype = dv1.Rows[RowIndex].Cells["dvc_author_divtype"].Value?.ToString() ?? string.Empty;
|
||||
var author_divnum = dv1.Rows[RowIndex].Cells["dvc_author_divnum"].Value?.ToString() ?? string.Empty;
|
||||
if (author_first.isEmpty() == false) cb_FirstAuthor.Text = author_first;
|
||||
else cb_FirstAuthor.SelectedIndex = -1;
|
||||
if (author_type.isEmpty() == false) cb_authorType.Text = author_type;
|
||||
else cb_authorType.SelectedIndex = -1;
|
||||
if (author_firstbook.isEmpty() == false) cb_FirstBook.Text = author_firstbook;
|
||||
else cb_FirstBook.SelectedIndex = -1;
|
||||
if (author_divtype.isEmpty() == false) cb_divType.Text = author_divtype;
|
||||
else cb_divType.SelectedIndex = -1;
|
||||
if (author_divnum.isEmpty() == false) cb_divNum.Text = author_divnum;
|
||||
else cb_divNum.SelectedIndex = -1;
|
||||
|
||||
|
||||
Select_Gubun(RowIndex);
|
||||
}
|
||||
private void Select_Gubun(int pRowIndex)
|
||||
@@ -350,7 +397,8 @@ namespace WindowsFormsApp1.Home
|
||||
case "도서관":
|
||||
cb_gubun2.SelectedIndex = 7;
|
||||
break;
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
if (gubun == "서점" || gubun == "기타")
|
||||
{
|
||||
@@ -364,7 +412,8 @@ namespace WindowsFormsApp1.Home
|
||||
case "기타":
|
||||
cb_gubun2.SelectedIndex = 2;
|
||||
break;
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
private void tb_sangho_KeyDown(object sender, KeyEventArgs e)
|
||||
@@ -386,7 +435,8 @@ namespace WindowsFormsApp1.Home
|
||||
"`c_uptae`, `c_jongmok`, `c_tel`, `c_fax`, `c_email`, " +
|
||||
"`c_man`, `c_mantel`, `c_user`, `c_zip`, `c_addr`, " +
|
||||
"`c_dlsArea`, `c_dlsID`, `c_dlsPW`, `c_division`, `c_label`," +
|
||||
" `c_program`, `c_etc`";
|
||||
"`c_program`, `c_etc`,"+
|
||||
"`c_author_first`, `c_author_type`, `c_author_firstbook`, `c_author_divtype`, `c_author_divnum`";
|
||||
string cmd = db.DB_Contains("Client", compidx, "c_sangho", tbSearch.Text, search);
|
||||
db.DB_Send_CMD_Search_ApplyGrid(cmd, dv1);
|
||||
|
||||
@@ -567,12 +617,12 @@ namespace WindowsFormsApp1.Home
|
||||
try
|
||||
{
|
||||
this.dv1.ExportData(sd.FileName);
|
||||
if(UTIL.MsgQ("생성된 파일을 확인 할까요?") == DialogResult.Yes)
|
||||
if (UTIL.MsgQ("생성된 파일을 확인 할까요?") == DialogResult.Yes)
|
||||
UTIL.RunExplorer(sd.FileName);
|
||||
}
|
||||
|
||||
catch (Exception ex) { UTIL.MsgE(ex.Message); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user