Selaa lähdekoodia

ref: DirectoryInfo、FileInfo

龙腾猫跃 5 kuukautta sitten
vanhempi
sitoutus
9bfa70dc8d
2 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  1. 5 0
      Shared/Utils/DirectoryUtils.cs
  2. 5 0
      Shared/Utils/FileUtils.cs

+ 5 - 0
Shared/Utils/DirectoryUtils.cs

@@ -15,4 +15,9 @@ public static class DirectoryUtils {
     /// </summary>
     /// </summary>
     public static bool Exists(string path) => Directory.Exists(PathUtils.ToLongPath(path));
     public static bool Exists(string path) => Directory.Exists(PathUtils.ToLongPath(path));
 
 
+    /// <summary>
+    /// 创建 <see cref="DirectoryInfo"/> 对象。
+    /// </summary>
+    public static DirectoryInfo GetInfo(string path) => new(PathUtils.ToLongPath(path));
+
 }
 }

+ 5 - 0
Shared/Utils/FileUtils.cs

@@ -45,4 +45,9 @@ public static class FileUtils {
     /// </summary>
     /// </summary>
     public static bool Exists(string filePath) => File.Exists(PathUtils.ToLongPath(filePath));
     public static bool Exists(string filePath) => File.Exists(PathUtils.ToLongPath(filePath));
 
 
+    /// <summary>
+    /// 创建 <see cref="FileInfo"/> 对象。
+    /// </summary>
+    public static FileInfo GetInfo(string path) => new(PathUtils.ToLongPath(path));
+
 }
 }