| | |
| | | private bool includeSubfolders = true;
|
| | | private bool compareByContent = true;
|
| | | private bool compareByName = false;
|
| | | private int minFileSize = 10;
|
| | | private int minFileSize = 100;
|
| | |
|
| | | private Dictionary<string, List<string>> duplicateGroups = new Dictionary<string, List<string>>();
|
| | | private int totalFilesScanned = 0;
|
| | |
| | | private bool isProcessing = false;
|
| | | private float progress = 0f;
|
| | | private string progressInfo = "";
|
| | |
|
| | | private string filterString = "";
|
| | | private bool enableFilter = false;
|
| | |
|
| | | [MenuItem("工具/资源管理/资源查重工具")]
|
| | | public static void ShowWindow()
|
| | |
| | | }
|
| | |
|
| | | EditorGUILayout.Space();
|
| | |
|
| | | // 搜索结果过滤功能
|
| | | EditorGUILayout.BeginVertical();
|
| | | enableFilter = EditorGUILayout.Toggle("启用结果过滤", enableFilter, GUILayout.Width(120));
|
| | | EditorGUILayout.Space();
|
| | | filterString = EditorGUILayout.TextField("过滤字符串", filterString);
|
| | | EditorGUILayout.EndVertical();
|
| | |
|
| | | if (duplicateGroups.Count > 0)
|
| | | {
|
| | |
| | | includeSubfolders = EditorGUILayout.Toggle("包含子文件夹", includeSubfolders);
|
| | | compareByContent = EditorGUILayout.Toggle("按内容比较", compareByContent);
|
| | | compareByName = EditorGUILayout.Toggle("按名称比较", compareByName);
|
| | | minFileSize = EditorGUILayout.IntField("最小文件大小 (KB)", minFileSize);
|
| | | minFileSize = EditorGUILayout.IntField("最小文件大小 (B)", minFileSize);
|
| | |
|
| | | EditorGUILayout.Space();
|
| | | EditorGUILayout.LabelField("处理选项:");
|
| | |
| | | int groupIndex = 0;
|
| | | foreach (var group in duplicateGroups)
|
| | | {
|
| | | // 过滤逻辑:只显示包含过滤字符串的组
|
| | | if (enableFilter && !group.Value.Any(f => Path.GetFileName(f).IndexOf(filterString, StringComparison.OrdinalIgnoreCase) >= 0))
|
| | | continue;
|
| | |
|
| | | if (group.Value.Count <= 1) continue;
|
| | |
|
| | | groupIndex++;
|
| | |
| | |
|
| | | // 检查文件大小
|
| | | FileInfo fileInfo = new FileInfo(fullPath);
|
| | | if (!fileInfo.Exists || fileInfo.Length < minFileSize * 1024) continue;
|
| | | if (!fileInfo.Exists || fileInfo.Length < minFileSize) continue;
|
| | |
|
| | | string key = "";
|
| | |
|
| | |
| | |
|
| | | // 更新引用关系,将引用从filePath重定向到keepFile
|
| | | UpdateReferences(filePath, keepFile);
|
| | | |
| | | // ... existing code ...
|
| | |
|
| | | // 创建备份和删除文件的代码
|
| | | }
|