up
This commit is contained in:
parent
8a1f2b5a7b
commit
c7cd4794c5
21
AsmrManage/AsmrManage/AsmrData.cs
Normal file
21
AsmrManage/AsmrManage/AsmrData.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsmrManage
|
||||
{
|
||||
public class AsmrData
|
||||
{
|
||||
public string file_rj_str { get; set; } = string.Empty;
|
||||
public string file_d_str { get; set; } = string.Empty;
|
||||
public string file_vj_str { get; set; } = string.Empty;
|
||||
public string file_nonhrj_str { get; set; } = string.Empty;
|
||||
public string db_rj_str { get; set; } = string.Empty;
|
||||
public string db_d_str { get; set; } = string.Empty;
|
||||
public string db_vj_str { get; set; } = string.Empty;
|
||||
public string db_nonhrj_str { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ using OfficeOpenXml;
|
||||
using System.Data.SQLite;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualBasic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsmrManage
|
||||
{
|
||||
@ -449,6 +450,13 @@ namespace AsmrManage
|
||||
label28.Text = vjData.Count.ToString();
|
||||
label29.Text = nonhrjData.Count.ToString();
|
||||
|
||||
SaveDataP3(rjDirectories, dDirectories, vjDirectories, nonhrjDirectories, rjData, dData, vjData, nonhrjData);
|
||||
Logp3("¶ÁÈ¡Íê±Ï");
|
||||
|
||||
}
|
||||
|
||||
private static void SaveDataP3(List<string> rjDirectories, List<string> dDirectories, List<string> vjDirectories, List<string> nonhrjDirectories, List<string> rjData, List<string> dData, List<string> vjData, List<string> nonhrjData)
|
||||
{
|
||||
NaturalOrderComparer comparer = new NaturalOrderComparer();
|
||||
rjDirectories.Sort(comparer);
|
||||
dDirectories.Sort(comparer);
|
||||
@ -458,10 +466,17 @@ namespace AsmrManage
|
||||
dData.Sort(comparer);
|
||||
vjData.Sort(comparer);
|
||||
nonhrjData.Sort(comparer);
|
||||
|
||||
Logp3("读取完毕");
|
||||
|
||||
Program.data ??= new AsmrData();
|
||||
Program.data.file_rj_str = string.Join(Environment.NewLine, rjDirectories);
|
||||
Program.data.file_d_str = string.Join(Environment.NewLine, dDirectories);
|
||||
Program.data.file_vj_str = string.Join(Environment.NewLine, vjDirectories);
|
||||
Program.data.file_nonhrj_str = string.Join(Environment.NewLine, nonhrjDirectories);
|
||||
Program.data.db_rj_str = string.Join(Environment.NewLine, rjData);
|
||||
Program.data.db_d_str = string.Join(Environment.NewLine, dData);
|
||||
Program.data.db_vj_str = string.Join(Environment.NewLine, vjData);
|
||||
Program.data.db_nonhrj_str = string.Join(Environment.NewLine, nonhrjData);
|
||||
}
|
||||
|
||||
private void Logp3(string message) //p3 log function
|
||||
{
|
||||
richTextBox2.AppendText(message + Environment.NewLine);
|
||||
@ -470,61 +485,44 @@ namespace AsmrManage
|
||||
|
||||
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<string> set1 = new HashSet<string>() { "A", "B", "C" };
|
||||
HashSet<string> set2 = new HashSet<string>() { "B", "C", "D" };
|
||||
|
||||
// 将 HashSet 转换为 List(也可以选择转换为数组)
|
||||
List<string> list1 = new List<string>(set1);
|
||||
List<string> list2 = new List<string>(set2);
|
||||
|
||||
// 创建一个比较器
|
||||
//InlineDiffBuilder.Diff();
|
||||
|
||||
|
||||
// 获取差异细节
|
||||
List<string> addedItems = new List<string>();
|
||||
List<string> deletedItems = new List<string>();
|
||||
List<string> modifiedItems = new List<string>();
|
||||
|
||||
//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)
|
||||
Program.data ??= new AsmrData();
|
||||
if (checkBox9.Checked)
|
||||
{
|
||||
Console.WriteLine(item);
|
||||
Logp3("# H_RJ²îÒìÇé¿ö:");
|
||||
DiffContent(Program.data.file_rj_str, Program.data.db_rj_str);
|
||||
}
|
||||
if (checkBox10.Checked)
|
||||
{
|
||||
Logp3("# H_D²îÒìÇé¿ö:");
|
||||
DiffContent(Program.data.file_d_str, Program.data.db_d_str);
|
||||
}
|
||||
if (checkBox11.Checked)
|
||||
{
|
||||
Logp3("# H_VJ²îÒìÇé¿ö:");
|
||||
DiffContent(Program.data.file_vj_str, Program.data.db_vj_str);
|
||||
}
|
||||
if (checkBox12.Checked)
|
||||
{
|
||||
Logp3("# NonH_RJ²îÒìÇé¿ö:");
|
||||
DiffContent(Program.data.file_nonhrj_str, Program.data.db_nonhrj_str);
|
||||
}
|
||||
|
||||
Console.WriteLine("Deleted Items:");
|
||||
foreach (string item in deletedItems)
|
||||
{
|
||||
Console.WriteLine(item);
|
||||
}
|
||||
|
||||
Console.WriteLine("Modified Items:");
|
||||
foreach (string item in modifiedItems)
|
||||
private void DiffContent(string before, string after)
|
||||
{
|
||||
Console.WriteLine(item);
|
||||
var diff_rj = InlineDiffBuilder.Diff(before, after);
|
||||
foreach (var line in diff_rj.Lines)
|
||||
{
|
||||
switch (line.Type)
|
||||
{
|
||||
case ChangeType.Inserted:
|
||||
Logp3("+ " + line.Text);
|
||||
break;
|
||||
case ChangeType.Deleted:
|
||||
Logp3("- " + line.Text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ namespace AsmrManage
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
public static AppConfig? config;
|
||||
public static AsmrData? data;
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
|
Reference in New Issue
Block a user