diff --git a/Shared/Utils/DirectoryUtils.cs b/Shared/Utils/DirectoryUtils.cs
index fdd24c7..48fbaec 100644
--- a/Shared/Utils/DirectoryUtils.cs
+++ b/Shared/Utils/DirectoryUtils.cs
@@ -13,11 +13,28 @@ public static class DirectoryUtils {
///
/// 判断文件夹是否存在。
///
- public static bool Exists(string path) => Directory.Exists(PathUtils.ToLongPath(path));
+ public static bool Exists(string path) =>
+ Directory.Exists(PathUtils.ToLongPath(path));
///
/// 创建 对象。
///
- public static DirectoryInfo GetInfo(string path) => new(PathUtils.ToLongPath(path));
+ public static DirectoryInfo GetInfo(string path) =>
+ new(PathUtils.ToLongPath(path));
+ ///
+ /// 返回指定路径下的所有文件。
+ ///
+ public static IEnumerable EnumerateFiles(string path, string searchPattern = "*", bool topDirectoryOnly = false) {
+ if (!Exists(path)) return [];
+ return Directory.EnumerateFiles(PathUtils.ToLongPath(path), searchPattern, topDirectoryOnly ? SearchOption.TopDirectoryOnly : SearchOption.AllDirectories);
+ }
+
+ ///
+ /// 返回指定路径下的所有文件夹。
+ ///
+ public static IEnumerable EnumerateDirectories(string path, string searchPattern = "*", bool topDirectoryOnly = false) {
+ if (!Exists(path)) return [];
+ return Directory.EnumerateDirectories(PathUtils.ToLongPath(path), searchPattern, topDirectoryOnly ? SearchOption.TopDirectoryOnly : SearchOption.AllDirectories);
+ }
}