diff --git a/AsmrManage/AsmrManage.sln b/AsmrManage/AsmrManage.sln index 00f4d21..6f1bd61 100644 --- a/AsmrManage/AsmrManage.sln +++ b/AsmrManage/AsmrManage.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.7.34031.279 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsmrManage", "AsmrManage\AsmrManage.csproj", "{7D569CE3-1810-4036-B166-2723176A65F0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsmrManage", "AsmrManage\AsmrManage.csproj", "{7D569CE3-1810-4036-B166-2723176A65F0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/AsmrManage/AsmrManage/7za.exe b/AsmrManage/AsmrManage/7za.exe new file mode 100644 index 0000000..dcc0622 Binary files /dev/null and b/AsmrManage/AsmrManage/7za.exe differ diff --git a/AsmrManage/AsmrManage/AppConfig.cs b/AsmrManage/AsmrManage/AppConfig.cs index c3a8229..71a0b27 100644 --- a/AsmrManage/AsmrManage/AppConfig.cs +++ b/AsmrManage/AsmrManage/AppConfig.cs @@ -2,7 +2,7 @@ namespace AsmrManage { - public class AppConfig + public class AppConfig //应用配置 { public string DatabaseFilePath { get; set; } = string.Empty; //asmr.db 位置 public string DBBrowserPath { get; set; } = string.Empty; //DBBrowser 位置 diff --git a/AsmrManage/AsmrManage/AsmrData.cs b/AsmrManage/AsmrManage/AsmrData.cs index dc8be65..776b41f 100644 --- a/AsmrManage/AsmrManage/AsmrData.cs +++ b/AsmrManage/AsmrManage/AsmrData.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace AsmrManage { - public class AsmrData + public class AsmrData //存放比较数据 { public string file_rj_str { get; set; } = string.Empty; public string file_d_str { get; set; } = string.Empty; diff --git a/AsmrManage/AsmrManage/AsmrManage.csproj b/AsmrManage/AsmrManage/AsmrManage.csproj index 1eca4ae..5a3b809 100644 --- a/AsmrManage/AsmrManage/AsmrManage.csproj +++ b/AsmrManage/AsmrManage/AsmrManage.csproj @@ -33,4 +33,13 @@ + + + Always + + + Always + + + \ No newline at end of file diff --git a/AsmrManage/AsmrManage/Form1.Designer.cs b/AsmrManage/AsmrManage/Form1.Designer.cs index 57dbe49..5e88033 100644 --- a/AsmrManage/AsmrManage/Form1.Designer.cs +++ b/AsmrManage/AsmrManage/Form1.Designer.cs @@ -44,11 +44,6 @@ 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(); @@ -117,7 +112,6 @@ tabControl1.SuspendLayout(); tabPage1.SuspendLayout(); groupBox5.SuspendLayout(); - groupBox4.SuspendLayout(); groupBox3.SuspendLayout(); tabPage2.SuspendLayout(); groupBox2.SuspendLayout(); @@ -158,7 +152,6 @@ tabPage1.Controls.Add(textBox6); tabPage1.Controls.Add(label9); tabPage1.Controls.Add(groupBox5); - tabPage1.Controls.Add(groupBox4); tabPage1.Controls.Add(groupBox3); tabPage1.Location = new Point(4, 24); tabPage1.Name = "tabPage1"; @@ -172,7 +165,7 @@ // label12.AutoSize = true; label12.Font = new Font("Segoe UI", 12F, FontStyle.Regular, GraphicsUnit.Point); - label12.Location = new Point(22, 165); + label12.Location = new Point(81, 185); label12.Name = "label12"; label12.Size = new Size(61, 21); label12.TabIndex = 15; @@ -181,7 +174,7 @@ // label11 // label11.AutoSize = true; - label11.Location = new Point(6, 138); + label11.Location = new Point(36, 160); label11.Name = "label11"; label11.Size = new Size(62, 15); label11.TabIndex = 14; @@ -190,7 +183,7 @@ // label10 // label10.AutoSize = true; - label10.Location = new Point(6, 73); + label10.Location = new Point(21, 78); label10.Name = "label10"; label10.Size = new Size(33, 15); label10.TabIndex = 13; @@ -198,26 +191,29 @@ // // comboBox1 // + comboBox1.DropDownStyle = ComboBoxStyle.DropDownList; comboBox1.FormattingEnabled = true; - comboBox1.Items.AddRange(new object[] { "H_RJ", "H_D", "H_VJ", "NonH_RJ" }); - comboBox1.Location = new Point(6, 91); + comboBox1.Items.AddRange(new object[] { "Auto", "H_RJ", "H_D", "H_VJ", "NonH_RJ" }); + comboBox1.Location = new Point(21, 96); comboBox1.Name = "comboBox1"; comboBox1.Size = new Size(121, 23); comboBox1.TabIndex = 12; // // button14 // - button14.Location = new Point(293, 43); + button14.Location = new Point(308, 48); button14.Name = "button14"; button14.Size = new Size(23, 23); button14.TabIndex = 10; button14.Text = "X"; + button14.TextAlign = ContentAlignment.MiddleRight; button14.UseVisualStyleBackColor = true; + button14.Click += button14_Click; // // button13 // button13.Enabled = false; - button13.Location = new Point(159, 218); + button13.Location = new Point(345, 94); button13.Name = "button13"; button13.Size = new Size(157, 32); button13.TabIndex = 9; @@ -227,7 +223,7 @@ // // button12 // - button12.Location = new Point(159, 142); + button12.Location = new Point(345, 18); button12.Name = "button12"; button12.Size = new Size(157, 70); button12.TabIndex = 8; @@ -237,7 +233,7 @@ // // textBox6 // - textBox6.Location = new Point(6, 43); + textBox6.Location = new Point(21, 48); textBox6.Name = "textBox6"; textBox6.Size = new Size(281, 23); textBox6.TabIndex = 7; @@ -245,7 +241,7 @@ // label9 // label9.AutoSize = true; - label9.Location = new Point(6, 25); + label9.Location = new Point(21, 30); label9.Name = "label9"; label9.Size = new Size(77, 15); label9.TabIndex = 6; @@ -257,9 +253,9 @@ groupBox5.Controls.Add(checkBox7); groupBox5.Controls.Add(checkBox6); groupBox5.Controls.Add(checkBox5); - groupBox5.Location = new Point(322, 112); + groupBox5.Location = new Point(322, 138); groupBox5.Name = "groupBox5"; - groupBox5.Size = new Size(200, 145); + groupBox5.Size = new Size(200, 119); groupBox5.TabIndex = 5; groupBox5.TabStop = false; groupBox5.Text = "选项"; @@ -277,11 +273,12 @@ // checkBox7 // checkBox7.AutoSize = true; + checkBox7.Enabled = false; checkBox7.Location = new Point(6, 72); checkBox7.Name = "checkBox7"; - checkBox7.Size = new Size(170, 19); + checkBox7.Size = new Size(168, 19); checkBox7.TabIndex = 2; - checkBox7.Text = "自动判断类别(仅支持H_*)"; + checkBox7.Text = "自动判断类别(Auto)(仅H)"; checkBox7.UseVisualStyleBackColor = true; // // checkBox6 @@ -304,58 +301,6 @@ 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); @@ -889,27 +834,29 @@ // // button16 // - button16.Location = new Point(469, 353); + button16.Location = new Point(451, 353); button16.Name = "button16"; - button16.Size = new Size(53, 37); + button16.Size = new Size(71, 37); button16.TabIndex = 2; button16.Text = "清空"; button16.UseVisualStyleBackColor = true; + button16.Click += button16_Click; // // button15 // - button15.Location = new Point(469, 267); + button15.Location = new Point(451, 267); button15.Name = "button15"; - button15.Size = new Size(53, 80); + button15.Size = new Size(71, 80); button15.TabIndex = 1; button15.Text = "保存日志"; button15.UseVisualStyleBackColor = true; + button15.Click += button15_Click; // // richTextBox2 // richTextBox2.Location = new Point(6, 267); richTextBox2.Name = "richTextBox2"; - richTextBox2.Size = new Size(457, 123); + richTextBox2.Size = new Size(439, 123); richTextBox2.TabIndex = 0; richTextBox2.Text = ""; // @@ -1057,8 +1004,6 @@ tabPage1.PerformLayout(); groupBox5.ResumeLayout(false); groupBox5.PerformLayout(); - groupBox4.ResumeLayout(false); - groupBox4.PerformLayout(); groupBox3.ResumeLayout(false); tabPage2.ResumeLayout(false); groupBox2.ResumeLayout(false); @@ -1117,11 +1062,6 @@ private Button button7; private GroupBox groupBox3; private RichTextBox richTextBox1; - private Button button10; - private Label label7; - private GroupBox groupBox4; - private Button button11; - private Label label8; private Button button13; private Button button12; private TextBox textBox6; diff --git a/AsmrManage/AsmrManage/Form1.cs b/AsmrManage/AsmrManage/Form1.cs index b4512b6..78b3556 100644 --- a/AsmrManage/AsmrManage/Form1.cs +++ b/AsmrManage/AsmrManage/Form1.cs @@ -1,11 +1,8 @@ using DiffPlex.DiffBuilder.Model; using DiffPlex.DiffBuilder; -using DiffPlex; using OfficeOpenXml; using System.Data.SQLite; using System.Diagnostics; -using Microsoft.VisualBasic; -using System.Collections.Generic; namespace AsmrManage { @@ -180,6 +177,7 @@ namespace AsmrManage private void TabControl1_SelectedIndexChanged(object sender, EventArgs e) //лǩҳ { ResetPage2(); + ResetPage3(); ResetPage4(); if (tabControl1.SelectedTab == tabPage4) { @@ -199,6 +197,23 @@ namespace AsmrManage textBox4.Text = string.Empty; textBox5.Text = string.Empty; } //ˢP4 + private void ResetPage3() //ˢP3 + { + textBox7.Text = string.Empty; + label18.Text = string.Empty; + label19.Text = string.Empty; + label20.Text = string.Empty; + label21.Text = string.Empty; + label26.Text = string.Empty; + label27.Text = string.Empty; + label28.Text = string.Empty; + label29.Text = string.Empty; + checkBox9.Checked = false; + checkBox10.Checked = false; + checkBox11.Checked = false; + checkBox12.Checked = false; + richTextBox2.Text = string.Empty; + } private void ResetPage2() { @@ -264,7 +279,7 @@ namespace AsmrManage } } - private void button5_Click(object sender, EventArgs e) + private void button5_Click(object sender, EventArgs e) //p4 EXEļλѡ2 { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Title = "ѡDB Browser for SQLite"; @@ -276,7 +291,7 @@ namespace AsmrManage } } - private void button6_Click(object sender, EventArgs e) + private void button6_Click(object sender, EventArgs e) //p4 db browserԤݿ { if (Program.config == null) { Program.config = ConfigManager.LoadConfig(); } string db_path = Program.config.DatabaseFilePath; @@ -315,9 +330,90 @@ namespace AsmrManage } - private void button12_Click(object sender, EventArgs e) + private void button12_Click(object sender, EventArgs e) //P1 { + //ǰ + //֤ݿļǷȷ + Program.config = ConfigManager.LoadConfig(); + string DbPath = Program.config.DatabaseFilePath; + if (!File.Exists(DbPath)) + { + Logp1("DBļ·ȼļ"); + return; + } + //ȡ/ӹؼʣǷϹ + string keyword = textBox6.Text.Trim(); + string pattern = "^(RJ|VJ|D)[0-9]+$"; // ƥRJVJDͷֵģʽ + if (System.Text.RegularExpressions.Regex.IsMatch(keyword, pattern)) + { + keyword = keyword.ToUpper(); // ؼתΪд + } + else + { + Logp1("ݸʽʽǷȷ"); + return; + } + //ȡѡ + //֧Auto,H_RJ,H_D,H_VJ,NonH_RJ + //Auto֧NonH_RJ + object selectedValue = comboBox1.SelectedItem; + string selectedText; + if (selectedValue != null) + { + selectedText = selectedValue.ToString(); + switch (selectedText) + { + case "H_RJ": + case "NonH_RJ": + if (System.Text.RegularExpressions.Regex.IsMatch(keyword, @"^RJ\d+$")) + { + // RJ + + break; + } + Logp1("ѡƥ"); + return; + + case "H_D": + if (System.Text.RegularExpressions.Regex.IsMatch(keyword, @"^D\d+$")) + { + // D + + break; + } + Logp1("ѡƥ"); + return; + + case "H_VJ": + if (System.Text.RegularExpressions.Regex.IsMatch(keyword, @"^VJ\d+$")) + { + // VJ + + break; + } + Logp1("ѡƥ"); + return; + + default: + Logp1("쳣"); + return; + + } + } + else + { + Logp1("δѡѡ"); + return; + } + //ȡѡֵ + bool Feature_Auto_Add = checkBox5.Checked; //ҺȱʱԶ + bool Feature_Auto_Clear = checkBox6.Checked; //ӺԶ + //bool Feature_Auto_Detect_Type = checkBox7.Checked; //Զ //ƶ + bool Feature_Auto_Backup = checkBox8.Checked; //Զݿ + //ִбݣҪ + if(Feature_Auto_Backup) + { + // string DbPath = Program.config.DatabaseFilePath; //ݿλ + + } } private void button17_Click(object sender, EventArgs e) //P3 ȡϢ @@ -375,6 +471,10 @@ namespace AsmrManage foreach (string directory in directories2) { 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)) { nonhrjDirectories.Add(directoryName); @@ -455,7 +555,7 @@ namespace AsmrManage } - private static void SaveDataP3(List rjDirectories, List dDirectories, List vjDirectories, List nonhrjDirectories, List rjData, List dData, List vjData, List nonhrjData) + private static void SaveDataP3(List rjDirectories, List dDirectories, List vjDirectories, List nonhrjDirectories, List rjData, List dData, List vjData, List nonhrjData) //ȡ񣬱ȡԺڱȽ { NaturalOrderComparer comparer = new NaturalOrderComparer(); rjDirectories.Sort(comparer); @@ -482,6 +582,11 @@ namespace AsmrManage richTextBox2.AppendText(message + Environment.NewLine); richTextBox2.ScrollToCaret(); } + private void Logp1(string message) //p1 log function + { + richTextBox1.AppendText(message + Environment.NewLine); + richTextBox1.ScrollToCaret(); + } private void button18_Click(object sender, EventArgs e) //p3Ƚ { @@ -509,7 +614,7 @@ namespace AsmrManage } - private void DiffContent(string before, string after) + private void DiffContent(string before, string after) //ݱȽϣϸڲ { var diff_rj = InlineDiffBuilder.Diff(before, after); foreach (var line in diff_rj.Lines) @@ -525,5 +630,42 @@ namespace AsmrManage } } } + + private void button15_Click(object sender, EventArgs e) //save p3 log + { + SaveFileDialog saveFileDialog = new SaveFileDialog(); + saveFileDialog.Filter = "Log Files|*.log"; + saveFileDialog.Title = "Save Log File"; + saveFileDialog.FileName = DateTime.Now.ToString("yyyy-MM-dd") + ".log"; + + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + string filePath = saveFileDialog.FileName; + + try + { + using (StreamWriter writer = new StreamWriter(filePath)) + { + writer.Write(richTextBox2.Text); + } + + MessageBox.Show("־ѳɹ档", "ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show("־ʱ" + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } + + private void button16_Click(object sender, EventArgs e) //p1ҹؼʿ + { + richTextBox2.Text = String.Empty; + } + + private void button14_Click(object sender, EventArgs e) + { + textBox6.Text = String.Empty; + } } } \ No newline at end of file diff --git a/AsmrManage/AsmrManage/NaturalOrderComparer.cs b/AsmrManage/AsmrManage/NaturalOrderComparer.cs index ca2d0f9..1a141b6 100644 --- a/AsmrManage/AsmrManage/NaturalOrderComparer.cs +++ b/AsmrManage/AsmrManage/NaturalOrderComparer.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace AsmrManage { - internal class NaturalOrderComparer : IComparer + internal class NaturalOrderComparer : IComparer //自然排序(自定义规则) { public int Compare(string? x, string? y) { @@ -17,7 +17,7 @@ namespace AsmrManage return numX.CompareTo(numY); } - private int ExtractNumber(string? input) + private int ExtractNumber(string? input) // 截取数字部分 { if (input == null) {