From e2b7855f48f00bb374438e84702f7eb0e7a5fecb Mon Sep 17 00:00:00 2001 From: dong <1278815766@qq.com> Date: Thu, 26 Jun 2025 10:45:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BA=86=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=92=8C=E7=9B=AE=E5=BD=95=E8=A2=AB=E5=88=86=E7=B1=BB=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Form1.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Form1.cs b/Form1.cs index a01df64..8709c94 100644 --- a/Form1.cs +++ b/Form1.cs @@ -126,8 +126,7 @@ namespace MD5Create // 生成目录结构的 json 表示 private Dictionary GenerateDirectoryJson(string directoryPath, string rootPath, int totalFiles, ref int processedFiles, string excludeFolder, string fileFolder) { - var filesDict = new Dictionary(StringComparer.OrdinalIgnoreCase); - var dirsDict = new Dictionary(StringComparer.OrdinalIgnoreCase); + var result = new Dictionary(StringComparer.OrdinalIgnoreCase); // 处理当前目录文件 string[] files; @@ -165,7 +164,7 @@ namespace MD5Create continue; } - filesDict[fileName] = fileMD5; + result[fileName] = fileMD5; try { @@ -237,15 +236,9 @@ namespace MD5Create continue; string dirName = Path.GetFileName(dir); - dirsDict[dirName] = GenerateDirectoryJson(dir, rootPath, totalFiles, ref processedFiles, excludeFolder, fileFolder); + result[dirName] = GenerateDirectoryJson(dir, rootPath, totalFiles, ref processedFiles, excludeFolder, fileFolder); } - var result = new Dictionary(StringComparer.OrdinalIgnoreCase) - { - { "files", filesDict }, - { "dirs", dirsDict } - }; - return result; }