using System; namespace Cosmos.System.FileSystem.Listing { using global::System.IO; /// /// Enumeration for the directory entry type. /// public enum DirectoryEntryTypeEnum { /// /// Directory /// Directory, /// /// File /// File, /// /// Unknown /// Unknown } /// /// A generic file system directory entry. /// public abstract class DirectoryEntry { public long mSize; public string mFullPath; public string mName; protected readonly FileSystem mFileSystem; public readonly DirectoryEntry mParent; public readonly DirectoryEntryTypeEnum mEntryType; /// /// Initializes a new instance of the class. /// /// The file system that contains the directory entry. /// The parent directory entry or null if the current entry is the root. /// The full path to the entry. /// The entry name. /// The size of the entry. /// The ype of the entry. /// /// /// Argument is null or empty /// /// /// protected DirectoryEntry(FileSystem aFileSystem, DirectoryEntry aParent, string aFullPath, string aName, long aSize, DirectoryEntryTypeEnum aEntryType) { if (aFileSystem == null) { throw new ArgumentNullException(nameof(aFileSystem)); } if (string.IsNullOrEmpty(aFullPath)) { throw new ArgumentException("Argument is null or empty", nameof(aFullPath)); } if (string.IsNullOrEmpty(aName)) { throw new ArgumentException("Argument is null or empty", nameof(aName)); } mFileSystem = aFileSystem; mParent = aParent; mEntryType = aEntryType; mName = aName; mSize = aSize; mFullPath = aFullPath; } public abstract void SetName(string aName); public abstract void SetSize(long aSize); public abstract Stream GetFileStream(); } }