解决了文件和目录被分类的问题
This commit is contained in:
13
Form1.cs
13
Form1.cs
@@ -126,8 +126,7 @@ namespace MD5Create
|
||||
// 生成目录结构的 json 表示
|
||||
private Dictionary<string, object> GenerateDirectoryJson(string directoryPath, string rootPath, int totalFiles, ref int processedFiles, string excludeFolder, string fileFolder)
|
||||
{
|
||||
var filesDict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
var dirsDict = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||
var result = new Dictionary<string, object>(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<string, object>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "files", filesDict },
|
||||
{ "dirs", dirsDict }
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user