public static FileDescriptor LoadFrom(MainStoragePath mainPath, string fullPath) { DateTime writeDate = File.GetLastWriteTimeUtc(fullPath); var info = new FileInfo(fullPath); long len = info.Length; return new FileDescriptor(mainPath.CreateRelative(fullPath), len, writeDate); }
public static FileSystemObjectDescriptor New(MainStoragePath mainPath, string fullPath) { if (File.Exists(fullPath)) { return FileDescriptor.LoadFrom(mainPath, fullPath); } if (Directory.Exists(fullPath)) { return new FolderDescriptor(mainPath.CreateRelative(fullPath)); } throw new FileNotFoundException(fullPath); }