diff --git a/AsmrManage/AsmrManage/AsmrManage.csproj b/AsmrManage/AsmrManage/AsmrManage.csproj index 067c3a0..1eca4ae 100644 --- a/AsmrManage/AsmrManage/AsmrManage.csproj +++ b/AsmrManage/AsmrManage/AsmrManage.csproj @@ -11,6 +11,7 @@ + diff --git a/AsmrManage/AsmrManage/Form1.Designer.cs b/AsmrManage/AsmrManage/Form1.Designer.cs index 022494b..57dbe49 100644 --- a/AsmrManage/AsmrManage/Form1.Designer.cs +++ b/AsmrManage/AsmrManage/Form1.Designer.cs @@ -30,6 +30,27 @@ { tabControl1 = new TabControl(); tabPage1 = new TabPage(); + label12 = new Label(); + label11 = new Label(); + label10 = new Label(); + comboBox1 = new ComboBox(); + button14 = new Button(); + button13 = new Button(); + button12 = new Button(); + textBox6 = new TextBox(); + label9 = new Label(); + groupBox5 = new GroupBox(); + checkBox8 = new CheckBox(); + checkBox7 = new CheckBox(); + checkBox6 = new CheckBox(); + checkBox5 = new CheckBox(); + groupBox4 = new GroupBox(); + button11 = new Button(); + label7 = new Label(); + button10 = new Button(); + label8 = new Label(); + groupBox3 = new GroupBox(); + richTextBox1 = new RichTextBox(); tabPage2 = new TabPage(); groupBox2 = new GroupBox(); logBox1 = new RichTextBox(); @@ -48,6 +69,38 @@ textBox1 = new TextBox(); button1 = new Button(); tabPage3 = new TabPage(); + groupBox7 = new GroupBox(); + button18 = new Button(); + checkBox11 = new CheckBox(); + checkBox12 = new CheckBox(); + checkBox9 = new CheckBox(); + checkBox10 = new CheckBox(); + groupBox6 = new GroupBox(); + splitContainer1 = new SplitContainer(); + label30 = new Label(); + label21 = new Label(); + label20 = new Label(); + label19 = new Label(); + label18 = new Label(); + label17 = new Label(); + label14 = new Label(); + label16 = new Label(); + label15 = new Label(); + label31 = new Label(); + label29 = new Label(); + label28 = new Label(); + label27 = new Label(); + label26 = new Label(); + label25 = new Label(); + label24 = new Label(); + label23 = new Label(); + label22 = new Label(); + button17 = new Button(); + textBox7 = new TextBox(); + label13 = new Label(); + button16 = new Button(); + button15 = new Button(); + richTextBox2 = new RichTextBox(); tabPage4 = new TabPage(); button9 = new Button(); button8 = new Button(); @@ -61,75 +114,22 @@ label5 = new Label(); tabPage5 = new TabPage(); label1 = new Label(); - groupBox3 = new GroupBox(); - richTextBox1 = new RichTextBox(); - label7 = new Label(); - button10 = new Button(); - label8 = new Label(); - groupBox4 = new GroupBox(); - button11 = new Button(); - groupBox5 = new GroupBox(); - label9 = new Label(); - textBox6 = new TextBox(); - button12 = new Button(); - button13 = new Button(); - button14 = new Button(); - comboBox1 = new ComboBox(); - label10 = new Label(); - checkBox5 = new CheckBox(); - checkBox6 = new CheckBox(); - label11 = new Label(); - label12 = new Label(); - checkBox7 = new CheckBox(); - checkBox8 = new CheckBox(); - richTextBox2 = new RichTextBox(); - button15 = new Button(); - button16 = new Button(); - label13 = new Label(); - textBox7 = new TextBox(); - button17 = new Button(); - groupBox6 = new GroupBox(); - label14 = new Label(); - label15 = new Label(); - label16 = new Label(); - label17 = new Label(); - splitContainer1 = new SplitContainer(); - label18 = new Label(); - label19 = new Label(); - label20 = new Label(); - label21 = new Label(); - label22 = new Label(); - label23 = new Label(); - label24 = new Label(); - label25 = new Label(); - label26 = new Label(); - label27 = new Label(); - label28 = new Label(); - label29 = new Label(); - label30 = new Label(); - label31 = new Label(); - checkBox9 = new CheckBox(); - checkBox10 = new CheckBox(); - checkBox11 = new CheckBox(); - checkBox12 = new CheckBox(); - groupBox7 = new GroupBox(); - button18 = new Button(); tabControl1.SuspendLayout(); tabPage1.SuspendLayout(); + groupBox5.SuspendLayout(); + groupBox4.SuspendLayout(); + groupBox3.SuspendLayout(); tabPage2.SuspendLayout(); groupBox2.SuspendLayout(); groupBox1.SuspendLayout(); tabPage3.SuspendLayout(); - tabPage4.SuspendLayout(); - groupBox3.SuspendLayout(); - groupBox4.SuspendLayout(); - groupBox5.SuspendLayout(); + groupBox7.SuspendLayout(); groupBox6.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit(); splitContainer1.Panel1.SuspendLayout(); splitContainer1.Panel2.SuspendLayout(); splitContainer1.SuspendLayout(); - groupBox7.SuspendLayout(); + tabPage4.SuspendLayout(); SuspendLayout(); // // tabControl1 @@ -168,6 +168,215 @@ tabPage1.Text = "查询&添加"; tabPage1.UseVisualStyleBackColor = true; // + // label12 + // + label12.AutoSize = true; + label12.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label12.Location = new Point(22, 165); + label12.Name = "label12"; + label12.Size = new Size(61, 21); + label12.TabIndex = 15; + label12.Text = "label12"; + // + // label11 + // + label11.AutoSize = true; + label11.Location = new Point(6, 138); + label11.Name = "label11"; + label11.Size = new Size(62, 15); + label11.TabIndex = 14; + label11.Text = "查找结果:"; + // + // label10 + // + label10.AutoSize = true; + label10.Location = new Point(6, 73); + label10.Name = "label10"; + label10.Size = new Size(33, 15); + label10.TabIndex = 13; + label10.Text = "类别"; + // + // comboBox1 + // + comboBox1.FormattingEnabled = true; + comboBox1.Items.AddRange(new object[] { "H_RJ", "H_D", "H_VJ", "NonH_RJ" }); + comboBox1.Location = new Point(6, 91); + comboBox1.Name = "comboBox1"; + comboBox1.Size = new Size(121, 23); + comboBox1.TabIndex = 12; + // + // button14 + // + button14.Location = new Point(293, 43); + button14.Name = "button14"; + button14.Size = new Size(23, 23); + button14.TabIndex = 10; + button14.Text = "X"; + button14.UseVisualStyleBackColor = true; + // + // button13 + // + button13.Enabled = false; + button13.Location = new Point(159, 218); + button13.Name = "button13"; + button13.Size = new Size(157, 32); + button13.TabIndex = 9; + button13.Text = "添加"; + button13.UseVisualStyleBackColor = true; + button13.Click += button13_Click; + // + // button12 + // + button12.Location = new Point(159, 142); + button12.Name = "button12"; + button12.Size = new Size(157, 70); + button12.TabIndex = 8; + button12.Text = "查找"; + button12.UseVisualStyleBackColor = true; + button12.Click += button12_Click; + // + // textBox6 + // + textBox6.Location = new Point(6, 43); + textBox6.Name = "textBox6"; + textBox6.Size = new Size(281, 23); + textBox6.TabIndex = 7; + // + // label9 + // + label9.AutoSize = true; + label9.Location = new Point(6, 25); + label9.Name = "label9"; + label9.Size = new Size(77, 15); + label9.TabIndex = 6; + label9.Text = "待查找/添加"; + // + // groupBox5 + // + groupBox5.Controls.Add(checkBox8); + groupBox5.Controls.Add(checkBox7); + groupBox5.Controls.Add(checkBox6); + groupBox5.Controls.Add(checkBox5); + groupBox5.Location = new Point(322, 112); + groupBox5.Name = "groupBox5"; + groupBox5.Size = new Size(200, 145); + groupBox5.TabIndex = 5; + groupBox5.TabStop = false; + groupBox5.Text = "选项"; + // + // checkBox8 + // + checkBox8.AutoSize = true; + checkBox8.Location = new Point(6, 97); + checkBox8.Name = "checkBox8"; + checkBox8.Size = new Size(117, 19); + checkBox8.TabIndex = 3; + checkBox8.Text = "自动备份数据库"; + checkBox8.UseVisualStyleBackColor = true; + // + // checkBox7 + // + checkBox7.AutoSize = true; + checkBox7.Location = new Point(6, 72); + checkBox7.Name = "checkBox7"; + checkBox7.Size = new Size(170, 19); + checkBox7.TabIndex = 2; + checkBox7.Text = "自动判断类别(仅支持H_*)"; + checkBox7.UseVisualStyleBackColor = true; + // + // checkBox6 + // + checkBox6.AutoSize = true; + checkBox6.Location = new Point(6, 47); + checkBox6.Name = "checkBox6"; + checkBox6.Size = new Size(174, 19); + checkBox6.TabIndex = 1; + checkBox6.Text = "添加后清空待查找/添加框"; + checkBox6.UseVisualStyleBackColor = true; + // + // checkBox5 + // + checkBox5.AutoSize = true; + checkBox5.Location = new Point(6, 22); + checkBox5.Name = "checkBox5"; + checkBox5.Size = new Size(156, 19); + checkBox5.TabIndex = 0; + checkBox5.Text = "查找后自动添加缺少项"; + checkBox5.UseVisualStyleBackColor = true; + // + // groupBox4 + // + groupBox4.Controls.Add(button11); + groupBox4.Controls.Add(label7); + groupBox4.Controls.Add(button10); + groupBox4.Controls.Add(label8); + groupBox4.Location = new Point(322, 6); + groupBox4.Name = "groupBox4"; + groupBox4.Size = new Size(200, 100); + groupBox4.TabIndex = 4; + groupBox4.TabStop = false; + groupBox4.Text = "数据库连接"; + // + // button11 + // + button11.Enabled = false; + button11.Location = new Point(98, 49); + button11.Name = "button11"; + button11.Size = new Size(102, 51); + button11.TabIndex = 5; + button11.Text = "结束"; + button11.UseVisualStyleBackColor = true; + // + // label7 + // + label7.AutoSize = true; + label7.Location = new Point(6, 19); + label7.Name = "label7"; + label7.Size = new Size(36, 15); + label7.TabIndex = 1; + label7.Text = "状态:"; + // + // button10 + // + button10.Location = new Point(0, 49); + button10.Name = "button10"; + button10.Size = new Size(102, 51); + button10.TabIndex = 2; + button10.Text = "开始"; + button10.UseVisualStyleBackColor = true; + button10.Click += button10_Click; + // + // label8 + // + label8.AutoSize = true; + label8.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label8.Location = new Point(45, 19); + label8.Name = "label8"; + label8.Size = new Size(77, 21); + label8.TabIndex = 3; + label8.Text = "Unknown"; + // + // groupBox3 + // + groupBox3.Controls.Add(richTextBox1); + groupBox3.Location = new Point(0, 256); + groupBox3.Name = "groupBox3"; + groupBox3.Size = new Size(528, 140); + groupBox3.TabIndex = 0; + groupBox3.TabStop = false; + groupBox3.Text = "Log"; + // + // richTextBox1 + // + richTextBox1.BackColor = Color.FromArgb(224, 224, 224); + richTextBox1.BorderStyle = BorderStyle.None; + richTextBox1.Location = new Point(6, 19); + richTextBox1.Name = "richTextBox1"; + richTextBox1.ReadOnly = true; + richTextBox1.Size = new Size(516, 112); + richTextBox1.TabIndex = 0; + richTextBox1.Text = ""; + // // tabPage2 // tabPage2.Controls.Add(groupBox2); @@ -368,6 +577,342 @@ tabPage3.Text = "数据核验"; tabPage3.UseVisualStyleBackColor = true; // + // groupBox7 + // + groupBox7.Controls.Add(button18); + groupBox7.Controls.Add(checkBox11); + groupBox7.Controls.Add(checkBox12); + groupBox7.Controls.Add(checkBox9); + groupBox7.Controls.Add(checkBox10); + groupBox7.Location = new Point(6, 197); + groupBox7.Name = "groupBox7"; + groupBox7.Size = new Size(516, 64); + groupBox7.TabIndex = 11; + groupBox7.TabStop = false; + groupBox7.Text = "比较"; + // + // button18 + // + button18.Location = new Point(432, 18); + button18.Name = "button18"; + button18.Size = new Size(75, 40); + button18.TabIndex = 11; + button18.Text = "获取差异"; + button18.UseVisualStyleBackColor = true; + button18.Click += button18_Click; + // + // checkBox11 + // + checkBox11.AutoSize = true; + checkBox11.Location = new Point(218, 30); + checkBox11.Name = "checkBox11"; + checkBox11.Size = new Size(51, 19); + checkBox11.TabIndex = 9; + checkBox11.Text = "H_VJ"; + checkBox11.UseVisualStyleBackColor = true; + // + // checkBox12 + // + checkBox12.AutoSize = true; + checkBox12.Location = new Point(318, 30); + checkBox12.Name = "checkBox12"; + checkBox12.Size = new Size(74, 19); + checkBox12.TabIndex = 10; + checkBox12.Text = "NonH_RJ"; + checkBox12.UseVisualStyleBackColor = true; + // + // checkBox9 + // + checkBox9.AutoSize = true; + checkBox9.Location = new Point(17, 30); + checkBox9.Name = "checkBox9"; + checkBox9.Size = new Size(51, 19); + checkBox9.TabIndex = 7; + checkBox9.Text = "H_RJ"; + checkBox9.UseVisualStyleBackColor = true; + // + // checkBox10 + // + checkBox10.AutoSize = true; + checkBox10.Location = new Point(117, 30); + checkBox10.Name = "checkBox10"; + checkBox10.Size = new Size(48, 19); + checkBox10.TabIndex = 8; + checkBox10.Text = "H_D"; + checkBox10.UseVisualStyleBackColor = true; + // + // groupBox6 + // + groupBox6.Controls.Add(splitContainer1); + groupBox6.Location = new Point(6, 39); + groupBox6.Name = "groupBox6"; + groupBox6.Size = new Size(516, 152); + groupBox6.TabIndex = 6; + groupBox6.TabStop = false; + groupBox6.Text = "状态"; + // + // splitContainer1 + // + splitContainer1.Location = new Point(6, 22); + splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + splitContainer1.Panel1.Controls.Add(label30); + splitContainer1.Panel1.Controls.Add(label21); + splitContainer1.Panel1.Controls.Add(label20); + splitContainer1.Panel1.Controls.Add(label19); + splitContainer1.Panel1.Controls.Add(label18); + splitContainer1.Panel1.Controls.Add(label17); + splitContainer1.Panel1.Controls.Add(label14); + splitContainer1.Panel1.Controls.Add(label16); + splitContainer1.Panel1.Controls.Add(label15); + // + // splitContainer1.Panel2 + // + splitContainer1.Panel2.Controls.Add(label31); + splitContainer1.Panel2.Controls.Add(label29); + splitContainer1.Panel2.Controls.Add(label28); + splitContainer1.Panel2.Controls.Add(label27); + splitContainer1.Panel2.Controls.Add(label26); + splitContainer1.Panel2.Controls.Add(label25); + splitContainer1.Panel2.Controls.Add(label24); + splitContainer1.Panel2.Controls.Add(label23); + splitContainer1.Panel2.Controls.Add(label22); + splitContainer1.Size = new Size(504, 124); + splitContainer1.SplitterDistance = 241; + splitContainer1.TabIndex = 4; + // + // label30 + // + label30.AutoSize = true; + label30.Location = new Point(101, 0); + label30.Name = "label30"; + label30.Size = new Size(33, 15); + label30.TabIndex = 8; + label30.Text = "本地"; + // + // label21 + // + label21.AutoSize = true; + label21.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label21.Location = new Point(170, 88); + label21.Name = "label21"; + label21.Size = new Size(61, 21); + label21.TabIndex = 7; + label21.Text = "label21"; + // + // label20 + // + label20.AutoSize = true; + label20.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label20.Location = new Point(170, 67); + label20.Name = "label20"; + label20.Size = new Size(61, 21); + label20.TabIndex = 6; + label20.Text = "label20"; + // + // label19 + // + label19.AutoSize = true; + label19.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label19.Location = new Point(170, 46); + label19.Name = "label19"; + label19.Size = new Size(61, 21); + label19.TabIndex = 5; + label19.Text = "label19"; + // + // label18 + // + label18.AutoSize = true; + label18.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label18.Location = new Point(170, 25); + label18.Name = "label18"; + label18.Size = new Size(61, 21); + label18.TabIndex = 4; + label18.Text = "label18"; + // + // label17 + // + label17.AutoSize = true; + label17.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label17.Location = new Point(11, 88); + label17.Name = "label17"; + label17.Size = new Size(77, 21); + label17.TabIndex = 3; + label17.Text = "NonH_RJ:"; + // + // label14 + // + label14.AutoSize = true; + label14.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label14.Location = new Point(11, 25); + label14.Name = "label14"; + label14.Size = new Size(47, 21); + label14.TabIndex = 0; + label14.Text = "H_RJ:"; + // + // label16 + // + label16.AutoSize = true; + label16.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label16.Location = new Point(11, 67); + label16.Name = "label16"; + label16.Size = new Size(46, 21); + label16.TabIndex = 2; + label16.Text = "H_VJ:"; + // + // label15 + // + label15.AutoSize = true; + label15.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label15.Location = new Point(11, 46); + label15.Name = "label15"; + label15.Size = new Size(42, 21); + label15.TabIndex = 1; + label15.Text = "H_D:"; + // + // label31 + // + label31.AutoSize = true; + label31.Location = new Point(110, 0); + label31.Name = "label31"; + label31.Size = new Size(46, 15); + label31.TabIndex = 8; + label31.Text = "数据库"; + // + // label29 + // + label29.AutoSize = true; + label29.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label29.Location = new Point(181, 88); + label29.Name = "label29"; + label29.Size = new Size(61, 21); + label29.TabIndex = 7; + label29.Text = "label29"; + // + // label28 + // + label28.AutoSize = true; + label28.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label28.Location = new Point(181, 67); + label28.Name = "label28"; + label28.Size = new Size(61, 21); + label28.TabIndex = 6; + label28.Text = "label28"; + // + // label27 + // + label27.AutoSize = true; + label27.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label27.Location = new Point(181, 46); + label27.Name = "label27"; + label27.Size = new Size(61, 21); + label27.TabIndex = 5; + label27.Text = "label27"; + // + // label26 + // + label26.AutoSize = true; + label26.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label26.Location = new Point(181, 25); + label26.Name = "label26"; + label26.Size = new Size(61, 21); + label26.TabIndex = 4; + label26.Text = "label26"; + // + // label25 + // + label25.AutoSize = true; + label25.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label25.Location = new Point(12, 88); + label25.Name = "label25"; + label25.Size = new Size(77, 21); + label25.TabIndex = 3; + label25.Text = "NonH_RJ:"; + // + // label24 + // + label24.AutoSize = true; + label24.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label24.Location = new Point(12, 67); + label24.Name = "label24"; + label24.Size = new Size(46, 21); + label24.TabIndex = 2; + label24.Text = "H_VJ:"; + // + // label23 + // + label23.AutoSize = true; + label23.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label23.Location = new Point(12, 46); + label23.Name = "label23"; + label23.Size = new Size(42, 21); + label23.TabIndex = 1; + label23.Text = "H_D:"; + // + // label22 + // + label22.AutoSize = true; + label22.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); + label22.Location = new Point(12, 25); + label22.Name = "label22"; + label22.Size = new Size(47, 21); + label22.TabIndex = 0; + label22.Text = "H_RJ:"; + // + // button17 + // + button17.Location = new Point(206, 10); + button17.Name = "button17"; + button17.Size = new Size(63, 23); + button17.TabIndex = 5; + button17.Text = "读取"; + button17.UseVisualStyleBackColor = true; + button17.Click += button17_Click; + // + // textBox7 + // + textBox7.Location = new Point(152, 10); + textBox7.Name = "textBox7"; + textBox7.Size = new Size(36, 23); + textBox7.TabIndex = 4; + // + // label13 + // + label13.AutoSize = true; + label13.Location = new Point(6, 13); + label13.Name = "label13"; + label13.Size = new Size(140, 15); + label13.TabIndex = 3; + label13.Text = "本地资源文件所在盘符:"; + // + // button16 + // + button16.Location = new Point(469, 353); + button16.Name = "button16"; + button16.Size = new Size(53, 37); + button16.TabIndex = 2; + button16.Text = "清空"; + button16.UseVisualStyleBackColor = true; + // + // button15 + // + button15.Location = new Point(469, 267); + button15.Name = "button15"; + button15.Size = new Size(53, 80); + button15.TabIndex = 1; + button15.Text = "保存日志"; + button15.UseVisualStyleBackColor = true; + // + // richTextBox2 + // + richTextBox2.Location = new Point(6, 267); + richTextBox2.Name = "richTextBox2"; + richTextBox2.Size = new Size(457, 123); + richTextBox2.TabIndex = 0; + richTextBox2.Text = ""; + // // tabPage4 // tabPage4.Controls.Add(button9); @@ -499,549 +1044,6 @@ label1.TabIndex = 0; label1.Text = "xlsx表格文件:"; // - // groupBox3 - // - groupBox3.Controls.Add(richTextBox1); - groupBox3.Location = new Point(0, 256); - groupBox3.Name = "groupBox3"; - groupBox3.Size = new Size(528, 140); - groupBox3.TabIndex = 0; - groupBox3.TabStop = false; - groupBox3.Text = "Log"; - // - // richTextBox1 - // - richTextBox1.BackColor = Color.FromArgb(224, 224, 224); - richTextBox1.BorderStyle = BorderStyle.None; - richTextBox1.Location = new Point(6, 19); - richTextBox1.Name = "richTextBox1"; - richTextBox1.ReadOnly = true; - richTextBox1.Size = new Size(516, 112); - richTextBox1.TabIndex = 0; - richTextBox1.Text = ""; - // - // label7 - // - label7.AutoSize = true; - label7.Location = new Point(6, 19); - label7.Name = "label7"; - label7.Size = new Size(36, 15); - label7.TabIndex = 1; - label7.Text = "状态:"; - // - // button10 - // - button10.Location = new Point(0, 49); - button10.Name = "button10"; - button10.Size = new Size(102, 51); - button10.TabIndex = 2; - button10.Text = "开始"; - button10.UseVisualStyleBackColor = true; - button10.Click += button10_Click; - // - // label8 - // - label8.AutoSize = true; - label8.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label8.Location = new Point(45, 19); - label8.Name = "label8"; - label8.Size = new Size(77, 21); - label8.TabIndex = 3; - label8.Text = "Unknown"; - // - // groupBox4 - // - groupBox4.Controls.Add(button11); - groupBox4.Controls.Add(label7); - groupBox4.Controls.Add(button10); - groupBox4.Controls.Add(label8); - groupBox4.Location = new Point(322, 6); - groupBox4.Name = "groupBox4"; - groupBox4.Size = new Size(200, 100); - groupBox4.TabIndex = 4; - groupBox4.TabStop = false; - groupBox4.Text = "数据库连接"; - // - // button11 - // - button11.Enabled = false; - button11.Location = new Point(98, 49); - button11.Name = "button11"; - button11.Size = new Size(102, 51); - button11.TabIndex = 5; - button11.Text = "结束"; - button11.UseVisualStyleBackColor = true; - // - // groupBox5 - // - groupBox5.Controls.Add(checkBox8); - groupBox5.Controls.Add(checkBox7); - groupBox5.Controls.Add(checkBox6); - groupBox5.Controls.Add(checkBox5); - groupBox5.Location = new Point(322, 112); - groupBox5.Name = "groupBox5"; - groupBox5.Size = new Size(200, 145); - groupBox5.TabIndex = 5; - groupBox5.TabStop = false; - groupBox5.Text = "选项"; - // - // label9 - // - label9.AutoSize = true; - label9.Location = new Point(6, 25); - label9.Name = "label9"; - label9.Size = new Size(77, 15); - label9.TabIndex = 6; - label9.Text = "待查找/添加"; - // - // textBox6 - // - textBox6.Location = new Point(6, 43); - textBox6.Name = "textBox6"; - textBox6.Size = new Size(281, 23); - textBox6.TabIndex = 7; - // - // button12 - // - button12.Location = new Point(159, 142); - button12.Name = "button12"; - button12.Size = new Size(157, 70); - button12.TabIndex = 8; - button12.Text = "查找"; - button12.UseVisualStyleBackColor = true; - button12.Click += button12_Click; - // - // button13 - // - button13.Enabled = false; - button13.Location = new Point(159, 218); - button13.Name = "button13"; - button13.Size = new Size(157, 32); - button13.TabIndex = 9; - button13.Text = "添加"; - button13.UseVisualStyleBackColor = true; - button13.Click += button13_Click; - // - // button14 - // - button14.Location = new Point(293, 43); - button14.Name = "button14"; - button14.Size = new Size(23, 23); - button14.TabIndex = 10; - button14.Text = "X"; - button14.UseVisualStyleBackColor = true; - // - // comboBox1 - // - comboBox1.FormattingEnabled = true; - comboBox1.Items.AddRange(new object[] { "H_RJ", "H_D", "H_VJ", "NonH_RJ" }); - comboBox1.Location = new Point(6, 91); - comboBox1.Name = "comboBox1"; - comboBox1.Size = new Size(121, 23); - comboBox1.TabIndex = 12; - // - // label10 - // - label10.AutoSize = true; - label10.Location = new Point(6, 73); - label10.Name = "label10"; - label10.Size = new Size(33, 15); - label10.TabIndex = 13; - label10.Text = "类别"; - // - // checkBox5 - // - checkBox5.AutoSize = true; - checkBox5.Location = new Point(6, 22); - checkBox5.Name = "checkBox5"; - checkBox5.Size = new Size(156, 19); - checkBox5.TabIndex = 0; - checkBox5.Text = "查找后自动添加缺少项"; - checkBox5.UseVisualStyleBackColor = true; - // - // checkBox6 - // - checkBox6.AutoSize = true; - checkBox6.Location = new Point(6, 47); - checkBox6.Name = "checkBox6"; - checkBox6.Size = new Size(174, 19); - checkBox6.TabIndex = 1; - checkBox6.Text = "添加后清空待查找/添加框"; - checkBox6.UseVisualStyleBackColor = true; - // - // label11 - // - label11.AutoSize = true; - label11.Location = new Point(6, 138); - label11.Name = "label11"; - label11.Size = new Size(62, 15); - label11.TabIndex = 14; - label11.Text = "查找结果:"; - // - // label12 - // - label12.AutoSize = true; - label12.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label12.Location = new Point(22, 165); - label12.Name = "label12"; - label12.Size = new Size(61, 21); - label12.TabIndex = 15; - label12.Text = "label12"; - // - // checkBox7 - // - checkBox7.AutoSize = true; - checkBox7.Location = new Point(6, 72); - checkBox7.Name = "checkBox7"; - checkBox7.Size = new Size(170, 19); - checkBox7.TabIndex = 2; - checkBox7.Text = "自动判断类别(仅支持H_*)"; - checkBox7.UseVisualStyleBackColor = true; - // - // checkBox8 - // - checkBox8.AutoSize = true; - checkBox8.Location = new Point(6, 97); - checkBox8.Name = "checkBox8"; - checkBox8.Size = new Size(117, 19); - checkBox8.TabIndex = 3; - checkBox8.Text = "自动备份数据库"; - checkBox8.UseVisualStyleBackColor = true; - // - // richTextBox2 - // - richTextBox2.Location = new Point(6, 267); - richTextBox2.Name = "richTextBox2"; - richTextBox2.Size = new Size(310, 123); - richTextBox2.TabIndex = 0; - richTextBox2.Text = ""; - // - // button15 - // - button15.Location = new Point(324, 267); - button15.Name = "button15"; - button15.Size = new Size(53, 80); - button15.TabIndex = 1; - button15.Text = "保存日志"; - button15.UseVisualStyleBackColor = true; - // - // button16 - // - button16.Location = new Point(324, 353); - button16.Name = "button16"; - button16.Size = new Size(53, 37); - button16.TabIndex = 2; - button16.Text = "清空"; - button16.UseVisualStyleBackColor = true; - // - // label13 - // - label13.AutoSize = true; - label13.Location = new Point(6, 13); - label13.Name = "label13"; - label13.Size = new Size(140, 15); - label13.TabIndex = 3; - label13.Text = "本地资源文件所在盘符:"; - // - // textBox7 - // - textBox7.Location = new Point(152, 10); - textBox7.Name = "textBox7"; - textBox7.Size = new Size(36, 23); - textBox7.TabIndex = 4; - // - // button17 - // - button17.Location = new Point(206, 10); - button17.Name = "button17"; - button17.Size = new Size(63, 23); - button17.TabIndex = 5; - button17.Text = "读取"; - button17.UseVisualStyleBackColor = true; - // - // groupBox6 - // - groupBox6.Controls.Add(splitContainer1); - groupBox6.Location = new Point(6, 39); - groupBox6.Name = "groupBox6"; - groupBox6.Size = new Size(516, 152); - groupBox6.TabIndex = 6; - groupBox6.TabStop = false; - groupBox6.Text = "状态"; - // - // label14 - // - label14.AutoSize = true; - label14.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label14.Location = new Point(11, 25); - label14.Name = "label14"; - label14.Size = new Size(47, 21); - label14.TabIndex = 0; - label14.Text = "H_RJ:"; - // - // label15 - // - label15.AutoSize = true; - label15.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label15.Location = new Point(11, 46); - label15.Name = "label15"; - label15.Size = new Size(42, 21); - label15.TabIndex = 1; - label15.Text = "H_D:"; - // - // label16 - // - label16.AutoSize = true; - label16.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label16.Location = new Point(11, 67); - label16.Name = "label16"; - label16.Size = new Size(46, 21); - label16.TabIndex = 2; - label16.Text = "H_VJ:"; - // - // label17 - // - label17.AutoSize = true; - label17.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label17.Location = new Point(11, 88); - label17.Name = "label17"; - label17.Size = new Size(77, 21); - label17.TabIndex = 3; - label17.Text = "NonH_RJ:"; - // - // splitContainer1 - // - splitContainer1.Location = new Point(6, 22); - splitContainer1.Name = "splitContainer1"; - // - // splitContainer1.Panel1 - // - splitContainer1.Panel1.Controls.Add(label30); - splitContainer1.Panel1.Controls.Add(label21); - splitContainer1.Panel1.Controls.Add(label20); - splitContainer1.Panel1.Controls.Add(label19); - splitContainer1.Panel1.Controls.Add(label18); - splitContainer1.Panel1.Controls.Add(label17); - splitContainer1.Panel1.Controls.Add(label14); - splitContainer1.Panel1.Controls.Add(label16); - splitContainer1.Panel1.Controls.Add(label15); - // - // splitContainer1.Panel2 - // - splitContainer1.Panel2.Controls.Add(label31); - splitContainer1.Panel2.Controls.Add(label29); - splitContainer1.Panel2.Controls.Add(label28); - splitContainer1.Panel2.Controls.Add(label27); - splitContainer1.Panel2.Controls.Add(label26); - splitContainer1.Panel2.Controls.Add(label25); - splitContainer1.Panel2.Controls.Add(label24); - splitContainer1.Panel2.Controls.Add(label23); - splitContainer1.Panel2.Controls.Add(label22); - splitContainer1.Size = new Size(504, 124); - splitContainer1.SplitterDistance = 241; - splitContainer1.TabIndex = 4; - // - // label18 - // - label18.AutoSize = true; - label18.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label18.Location = new Point(170, 25); - label18.Name = "label18"; - label18.Size = new Size(61, 21); - label18.TabIndex = 4; - label18.Text = "label18"; - // - // label19 - // - label19.AutoSize = true; - label19.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label19.Location = new Point(170, 46); - label19.Name = "label19"; - label19.Size = new Size(61, 21); - label19.TabIndex = 5; - label19.Text = "label19"; - // - // label20 - // - label20.AutoSize = true; - label20.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label20.Location = new Point(170, 67); - label20.Name = "label20"; - label20.Size = new Size(61, 21); - label20.TabIndex = 6; - label20.Text = "label20"; - // - // label21 - // - label21.AutoSize = true; - label21.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label21.Location = new Point(170, 88); - label21.Name = "label21"; - label21.Size = new Size(61, 21); - label21.TabIndex = 7; - label21.Text = "label21"; - // - // label22 - // - label22.AutoSize = true; - label22.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label22.Location = new Point(12, 25); - label22.Name = "label22"; - label22.Size = new Size(47, 21); - label22.TabIndex = 0; - label22.Text = "H_RJ:"; - // - // label23 - // - label23.AutoSize = true; - label23.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label23.Location = new Point(12, 46); - label23.Name = "label23"; - label23.Size = new Size(42, 21); - label23.TabIndex = 1; - label23.Text = "H_D:"; - // - // label24 - // - label24.AutoSize = true; - label24.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label24.Location = new Point(12, 67); - label24.Name = "label24"; - label24.Size = new Size(46, 21); - label24.TabIndex = 2; - label24.Text = "H_VJ:"; - // - // label25 - // - label25.AutoSize = true; - label25.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label25.Location = new Point(12, 88); - label25.Name = "label25"; - label25.Size = new Size(77, 21); - label25.TabIndex = 3; - label25.Text = "NonH_RJ:"; - // - // label26 - // - label26.AutoSize = true; - label26.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label26.Location = new Point(181, 25); - label26.Name = "label26"; - label26.Size = new Size(61, 21); - label26.TabIndex = 4; - label26.Text = "label26"; - // - // label27 - // - label27.AutoSize = true; - label27.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label27.Location = new Point(181, 46); - label27.Name = "label27"; - label27.Size = new Size(61, 21); - label27.TabIndex = 5; - label27.Text = "label27"; - // - // label28 - // - label28.AutoSize = true; - label28.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label28.Location = new Point(181, 67); - label28.Name = "label28"; - label28.Size = new Size(61, 21); - label28.TabIndex = 6; - label28.Text = "label28"; - // - // label29 - // - label29.AutoSize = true; - label29.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label29.Location = new Point(181, 88); - label29.Name = "label29"; - label29.Size = new Size(61, 21); - label29.TabIndex = 7; - label29.Text = "label29"; - // - // label30 - // - label30.AutoSize = true; - label30.Location = new Point(101, 0); - label30.Name = "label30"; - label30.Size = new Size(33, 15); - label30.TabIndex = 8; - label30.Text = "本地"; - // - // label31 - // - label31.AutoSize = true; - label31.Location = new Point(110, 0); - label31.Name = "label31"; - label31.Size = new Size(46, 15); - label31.TabIndex = 8; - label31.Text = "数据库"; - // - // checkBox9 - // - checkBox9.AutoSize = true; - checkBox9.Location = new Point(17, 22); - checkBox9.Name = "checkBox9"; - checkBox9.Size = new Size(83, 19); - checkBox9.TabIndex = 7; - checkBox9.Text = "checkBox9"; - checkBox9.UseVisualStyleBackColor = true; - // - // checkBox10 - // - checkBox10.AutoSize = true; - checkBox10.Location = new Point(117, 22); - checkBox10.Name = "checkBox10"; - checkBox10.Size = new Size(89, 19); - checkBox10.TabIndex = 8; - checkBox10.Text = "checkBox10"; - checkBox10.UseVisualStyleBackColor = true; - // - // checkBox11 - // - checkBox11.AutoSize = true; - checkBox11.Location = new Point(218, 22); - checkBox11.Name = "checkBox11"; - checkBox11.Size = new Size(89, 19); - checkBox11.TabIndex = 9; - checkBox11.Text = "checkBox11"; - checkBox11.UseVisualStyleBackColor = true; - // - // checkBox12 - // - checkBox12.AutoSize = true; - checkBox12.Location = new Point(318, 22); - checkBox12.Name = "checkBox12"; - checkBox12.Size = new Size(89, 19); - checkBox12.TabIndex = 10; - checkBox12.Text = "checkBox12"; - checkBox12.UseVisualStyleBackColor = true; - // - // groupBox7 - // - groupBox7.Controls.Add(button18); - groupBox7.Controls.Add(checkBox11); - groupBox7.Controls.Add(checkBox12); - groupBox7.Controls.Add(checkBox9); - groupBox7.Controls.Add(checkBox10); - groupBox7.Location = new Point(6, 197); - groupBox7.Name = "groupBox7"; - groupBox7.Size = new Size(516, 64); - groupBox7.TabIndex = 11; - groupBox7.TabStop = false; - groupBox7.Text = "比较"; - // - // button18 - // - button18.Location = new Point(432, 18); - button18.Name = "button18"; - button18.Size = new Size(75, 40); - button18.TabIndex = 11; - button18.Text = "button18"; - button18.UseVisualStyleBackColor = true; - // // Form1 // AutoScaleDimensions = new SizeF(7F, 15F); @@ -1053,19 +1055,19 @@ tabControl1.ResumeLayout(false); tabPage1.ResumeLayout(false); tabPage1.PerformLayout(); + groupBox5.ResumeLayout(false); + groupBox5.PerformLayout(); + groupBox4.ResumeLayout(false); + groupBox4.PerformLayout(); + groupBox3.ResumeLayout(false); tabPage2.ResumeLayout(false); groupBox2.ResumeLayout(false); groupBox1.ResumeLayout(false); groupBox1.PerformLayout(); tabPage3.ResumeLayout(false); tabPage3.PerformLayout(); - tabPage4.ResumeLayout(false); - tabPage4.PerformLayout(); - groupBox3.ResumeLayout(false); - groupBox4.ResumeLayout(false); - groupBox4.PerformLayout(); - groupBox5.ResumeLayout(false); - groupBox5.PerformLayout(); + groupBox7.ResumeLayout(false); + groupBox7.PerformLayout(); groupBox6.ResumeLayout(false); splitContainer1.Panel1.ResumeLayout(false); splitContainer1.Panel1.PerformLayout(); @@ -1073,8 +1075,8 @@ splitContainer1.Panel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)splitContainer1).EndInit(); splitContainer1.ResumeLayout(false); - groupBox7.ResumeLayout(false); - groupBox7.PerformLayout(); + tabPage4.ResumeLayout(false); + tabPage4.PerformLayout(); ResumeLayout(false); } diff --git a/AsmrManage/AsmrManage/Form1.cs b/AsmrManage/AsmrManage/Form1.cs index d09eb31..b2326e4 100644 --- a/AsmrManage/AsmrManage/Form1.cs +++ b/AsmrManage/AsmrManage/Form1.cs @@ -1,6 +1,10 @@ +using DiffPlex.DiffBuilder.Model; +using DiffPlex.DiffBuilder; +using DiffPlex; using OfficeOpenXml; using System.Data.SQLite; using System.Diagnostics; +using Microsoft.VisualBasic; namespace AsmrManage { @@ -314,5 +318,214 @@ namespace AsmrManage { } + + private void button17_Click(object sender, EventArgs e) //P3 ȡϢ + { + string driveLetter = textBox7.Text.Trim().ToUpper(); // ȡû̷תΪд + string drivePath = $"{driveLetter}:\\"; // ϳ̷· + + string filePath = Path.Combine(drivePath, "asmr_storage.txt"); // · + + if (File.Exists(filePath)) + { + Logp3("ʶҵʼȡϢ"); + } + else + { + Logp3("ָ·δҵʶ޷һ"); + return; + } + + string folderPath = Path.Combine(drivePath, "H"); + string folderPath2 = Path.Combine(drivePath, "Non-H"); + + // ȡָļµĿ¼ + string[] directories = Directory.GetDirectories(folderPath); + string[] directories2 = Directory.GetDirectories(folderPath2); + + // List治ͬǰ׺Ŀ¼ + List rjDirectories = new List(); + List dDirectories = new List(); + List vjDirectories = new List(); + List nonhrjDirectories = new List(); + + // Ŀ¼ǰ׺ӵӦList + foreach (string directory in directories) + { + string directoryName = Path.GetFileName(directory); + if (directoryName.EndsWith(".fin") || directoryName.EndsWith(".now")) + { + directoryName = directoryName.Substring(0, directoryName.Length - 4); + } + + if (directoryName.StartsWith("RJ", StringComparison.OrdinalIgnoreCase)) + { + rjDirectories.Add(directoryName); + } + else if (directoryName.StartsWith("D", StringComparison.OrdinalIgnoreCase)) + { + dDirectories.Add(directoryName); + } + else if (directoryName.StartsWith("VJ", StringComparison.OrdinalIgnoreCase)) + { + vjDirectories.Add(directoryName); + } + } + foreach (string directory in directories2) + { + string directoryName = Path.GetFileName(directory); + if (directoryName.StartsWith("RJ", StringComparison.OrdinalIgnoreCase)) + { + nonhrjDirectories.Add(directoryName); + } + } + label18.Text = rjDirectories.Count.ToString(); + label19.Text = dDirectories.Count.ToString(); + label20.Text = vjDirectories.Count.ToString(); + label21.Text = nonhrjDirectories.Count.ToString(); + + Program.config ??= ConfigManager.LoadConfig(); + string connectionString = $"Data Source={Program.config.DatabaseFilePath};Version=3"; // SQLiteݿַ + + // List治ͬ͵ + List rjData = new List(); + List dData = new List(); + List vjData = new List(); + List nonhrjData = new List(); + + // SQLiteݿ + using (SQLiteConnection connection = new SQLiteConnection(connectionString)) + { + connection.Open(); + + // ȡH_RJе + using (SQLiteCommand command = new SQLiteCommand("SELECT asmr_id FROM H_RJ", connection)) + using (SQLiteDataReader reader = command.ExecuteReader()) + { + while (reader.Read()) + { + string asmrName = reader.GetString(0); + rjData.Add(asmrName); + } + } + + // ȡH_Dе + using (SQLiteCommand command = new SQLiteCommand("SELECT asmr_id FROM H_D", connection)) + using (SQLiteDataReader reader = command.ExecuteReader()) + { + while (reader.Read()) + { + string asmrName = reader.GetString(0); + dData.Add(asmrName); + } + } + + // ȡH_VJе + using (SQLiteCommand command = new SQLiteCommand("SELECT asmr_id FROM H_VJ", connection)) + using (SQLiteDataReader reader = command.ExecuteReader()) + { + while (reader.Read()) + { + string asmrName = reader.GetString(0); + vjData.Add(asmrName); + } + } + + // ȡNonH_RJе + using (SQLiteCommand command = new SQLiteCommand("SELECT asmr_id FROM NonH_RJ", connection)) + using (SQLiteDataReader reader = command.ExecuteReader()) + { + while (reader.Read()) + { + string asmrName = reader.GetString(0); + nonhrjData.Add(asmrName); + } + } + + connection.Close(); + } + label26.Text = rjData.Count.ToString(); + label27.Text = dData.Count.ToString(); + label28.Text = vjData.Count.ToString(); + label29.Text = nonhrjData.Count.ToString(); + + NaturalOrderComparer comparer = new NaturalOrderComparer(); + rjDirectories.Sort(comparer); + dDirectories.Sort(comparer); + vjDirectories.Sort(comparer); + nonhrjDirectories.Sort(comparer); + rjData.Sort(comparer); + dData.Sort(comparer); + vjData.Sort(comparer); + nonhrjData.Sort(comparer); + + Logp3("ȡ"); + + } + private void Logp3(string message) //p3 log function + { + richTextBox2.AppendText(message + Environment.NewLine); + richTextBox2.ScrollToCaret(); + } + + private void button18_Click(object sender, EventArgs e) //p3Ƚ + { + bool diff_rj_enable = checkBox9.Checked; + bool diff_d_enable = checkBox10.Checked; + bool diff_vj_enable = checkBox11.Checked; + bool diff_nonhrj_enable = checkBox12.Checked; + + // HashSet + HashSet set1 = new HashSet() { "A", "B", "C" }; + HashSet set2 = new HashSet() { "B", "C", "D" }; + + // HashSet תΪ ListҲѡתΪ飩 + List list1 = new List(set1); + List list2 = new List(set2); + + // һȽ + //InlineDiffBuilder.Diff(); + + + // ȡϸ + List addedItems = new List(); + List deletedItems = new List(); + List modifiedItems = new List(); + + //foreach (var line in diffModel.Lines) + //{ + // if (line.Type == ChangeType.Inserted) + // { + // addedItems.Add(line.Text); + // } + // else if (line.Type == ChangeType.Deleted) + // { + // deletedItems.Add(line.Text); + // } + // else if (line.Type == ChangeType.Modified) + // { + // modifiedItems.Add(line.Text); + // } + //} + + // ӡϸ + Console.WriteLine("Added Items:"); + foreach (string item in addedItems) + { + Console.WriteLine(item); + } + + Console.WriteLine("Deleted Items:"); + foreach (string item in deletedItems) + { + Console.WriteLine(item); + } + + Console.WriteLine("Modified Items:"); + foreach (string item in modifiedItems) + { + Console.WriteLine(item); + } + } } } \ No newline at end of file diff --git a/AsmrManage/AsmrManage/NaturalOrderComparer.cs b/AsmrManage/AsmrManage/NaturalOrderComparer.cs new file mode 100644 index 0000000..ca2d0f9 --- /dev/null +++ b/AsmrManage/AsmrManage/NaturalOrderComparer.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AsmrManage +{ + internal class NaturalOrderComparer : IComparer + { + public int Compare(string? x, string? y) + { + // 提取字符串中的数字部分并将其转换为数字进行比较 + int numX = ExtractNumber(x); + int numY = ExtractNumber(y); + + return numX.CompareTo(numY); + } + + private int ExtractNumber(string? input) + { + if (input == null) + { + return 0; + } + string number = string.Empty; + foreach (char c in input) + { + if (char.IsDigit(c)) + { + number += c; + } + else if (number.Length > 0) + { + // 已经提取到数字部分,遇到非数字字符则停止提取 + break; + } + } + + if (int.TryParse(number, out int result)) + { + return result; + } + + // 默认情况下,无法提取数字,则返回 0 + return 0; + } + } +}