增加 导入外部微信数据

This commit is contained in:
chfei committed 2026-08-19 12:13:42 +08:00
1 parent 5ed558e343
commit a9f7b1f831
13 files changed
+2088 -1589

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
+75 -1
View File
@@ -1,4 +1,5 @@
using TemuKJD.BLL;
using TemuKJD.BLL.ImportConverts;
namespace KJD.Test
{
@@ -13,7 +14,80 @@ namespace KJD.Test
public void Test1()
{
string json = File.ReadAllText(@"C:\Users\chaih\Documents\xwechat_files\hongfei357_a567\msg\file\2026-08\850\531430339344.txt");
new PDDProdFormConverter().PddFrontToPddBackConvertFactory(json);
}
[Test]
public void TestWXToPDD()
{
string folderPath = @"C:\Users\chaih\Documents\xwechat_files\hongfei357_a567\msg\file\2026-08\破局(1)";
if (!Directory.Exists(folderPath))
{
Console.WriteLine($"文件夹不存在: {folderPath}");
return;
}
// 获取所有 txt 文件
var txtFiles = Directory.GetFiles(folderPath, "*.txt", SearchOption.AllDirectories);
if (txtFiles.Length == 0)
{
Console.WriteLine("未找到任何 .txt 文件");
return;
}
Console.WriteLine($"共找到 {txtFiles.Length} 个 txt 文件,开始扫描...\n");
Console.WriteLine(new string('-', 60));
var matchedFiles = new List<string>();
var unmatchedFiles = new List<string>();
var errorFiles = new List<string>();
foreach (var filePath in txtFiles)
{
try
{
// 读取文件内容
var frontProdInfo = ConverterToPddFactory.Convert(filePath);
var isMatch = frontProdInfo != null;
string fileName = Path.GetFileName(filePath);
string result = isMatch ? "✅ 匹配" : "❌ 不匹配";
Console.WriteLine($"[{result}] {fileName}");
if (isMatch)
{
matchedFiles.Add(fileName);
}
else
{
unmatchedFiles.Add(fileName);
}
}
catch (Exception ex)
{
string fileName = Path.GetFileName(filePath);
Console.WriteLine($"[⚠️ 读取失败] {fileName} - {ex.Message}");
errorFiles.Add(fileName);
}
}
// 输出统计结果
Console.WriteLine(new string('-', 60));
Console.WriteLine($"\n📊 扫描完成统计:");
Console.WriteLine($" ✅ 匹配: {matchedFiles.Count} 个");
Console.WriteLine($" ❌ 不匹配: {unmatchedFiles.Count} 个");
Console.WriteLine($" ⚠️ 读取失败: {errorFiles.Count} 个");
if (matchedFiles.Count > 0)
{
Console.WriteLine($"\n📋 匹配文件列表:");
foreach (var file in matchedFiles)
{
Console.WriteLine($" - {file}");
}
}
}
}
}