EasySign BETA
Digital Signing Tool
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Pages
Folder.cs
Go to the documentation of this file.
2{
6 public class Folder : FolderEntry
7 {
12 public Folder(OSPath fullPath)
13 : this(fullPath, OSPath.Empty)
14 {
15 }
16
22 public Folder(OSPath fullPath, OSPath root)
23 : base(fullPath, root)
24 {
25 }
26
32
37 public Folder Up() =>
39
45 public Folder Down(string folder) =>
46 new Folder(FullPath + folder, Root);
47
51 public bool Exists =>
52 Directory.Exists(FullPath);
53
57 public void Create() =>
58 Directory.CreateDirectory(FullPath);
59
65 public FolderFile File(OSPath path) =>
66 new FolderFile(FullPath + path, Root);
67
72 public IEnumerable<Folder> Folders() =>
73 from fullPath in Directory.EnumerateDirectories(FullPath)
74 select new Folder(fullPath, Root);
75
80 public IEnumerable<FolderFile> Files() =>
81 from fullPath in Directory.EnumerateFiles(FullPath)
82 select new FolderFile(fullPath, Root);
83 }
84}
Represents an abstract base class for folder entries.
Definition FolderEntry.cs:8
OSPath FullPath
Gets the full path of the folder entry.
OSPath Root
Gets the root path of the folder entry.
Represents a file within a folder in the unified path system.
Definition FolderFile.cs:7
Represents a folder in the file system and provides methods to interact with it.
Definition Folder.cs:7
Folder Up()
Returns a new Folder instance representing the parent directory.
IEnumerable< FolderFile > Files()
Enumerates the files in the folder.
FolderFile File(OSPath path)
Returns a FolderFile instance representing a file in the folder.
Folder Down(string folder)
Returns a new Folder instance representing a subdirectory.
Folder AsRoot()
Returns a new Folder instance with the current folder as the root.
bool Exists
Gets a value indicating whether the folder exists.
Definition Folder.cs:51
void Create()
Creates the folder if it does not already exist.
Folder(OSPath fullPath, OSPath root)
Initializes a new instance of the Folder class with the specified full path and root path.
Definition Folder.cs:22
IEnumerable< Folder > Folders()
Enumerates the subdirectories of the folder.
Folder(OSPath fullPath)
Initializes a new instance of the Folder class with the specified full path.
Definition Folder.cs:12
Represents an operating system path and provides methods for path conversion and manipulation.
Definition OSPath.cs:9
OSPath Parent
Gets the parent directory of the path.
Definition OSPath.cs:90