diff --git a/source/Cosmos.System2/FileSystem/CosmosVFS.cs b/source/Cosmos.System2/FileSystem/CosmosVFS.cs
index 5fdaa91ca..b4f6e553e 100644
--- a/source/Cosmos.System2/FileSystem/CosmosVFS.cs
+++ b/source/Cosmos.System2/FileSystem/CosmosVFS.cs
@@ -66,15 +66,36 @@ namespace Cosmos.System.FileSystem
///
/// The full path including the file to create.
/// DirectoryEntry value.
- /// Thrown if aPath is null.
- /// Thrown if aPath is empty or contains invalid chars.
- ///
+ ///
///
- /// - Thrown when the entry at aPath is not a file.
- /// - Thrown when the parent directory of aPath is not a directory.
+ /// - Thrown if aPath is null.
+ /// - aNewDirectory is null or empty.
+ /// - memory error.
///
///
- /// Thrown when aPath is longer than the system defined max lenght.
+ /// Thrown on memory error / unknown directory entry type.
+ /// Thrown when data lenght is greater then Int32.MaxValue.
+ ///
+ ///
+ /// - Thrown when data size invalid.
+ /// - invalid directory entry type.
+ /// - the entry at aPath is not a file.
+ /// - Thrown when the parent directory of aPath is not a directory.
+ /// - memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown if aPath length is zero.
+ /// - Thrown if aPath is invalid.
+ /// - memory error.
+ ///
+ ///
+ /// Thrown on memory error.
+ /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error (contact support).
+ /// Thrown on memory error.
+ /// Thrown when The aPath is longer than the system defined maximum length.
public override DirectoryEntry CreateFile(string aPath)
{
Global.mFileSystemDebugger.SendInternal("--- CosmosVFS.CreateFile ---");
@@ -125,9 +146,36 @@ namespace Cosmos.System.FileSystem
/// Creates a directory.
///
/// The full path including the directory to create.
- ///
- ///
- /// aPath
+ /// DirectoryEntry value.
+ ///
+ ///
+ /// - Thrown if aPath is null.
+ /// - aNewDirectory is null or empty.
+ /// - memory error.
+ ///
+ ///
+ /// Thrown on memory error / unknown directory entry type.
+ /// Thrown when data lenght is greater then Int32.MaxValue.
+ ///
+ ///
+ /// - Thrown when data size invalid.
+ /// - invalid directory entry type.
+ /// - the entry at aPath is not a directory.
+ /// - memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown if aPath length is zero.
+ /// - Thrown if aPath is invalid.
+ /// - memory error.
+ ///
+ ///
+ /// Thrown on memory error.
+ /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error (contact support).
+ /// Thrown on memory error.
+ /// Thrown when The aPath is longer than the system defined maximum length.
public override DirectoryEntry CreateDirectory(string aPath)
{
Global.mFileSystemDebugger.SendInternal("-- CosmosVFS.CreateDirectory ---");
@@ -139,7 +187,7 @@ namespace Cosmos.System.FileSystem
if (aPath.Length == 0)
{
- throw new ArgumentException("aPath");
+ throw new ArgumentException("aPath length is zero");
}
Global.mFileSystemDebugger.SendInternal("aPath = " + aPath);
@@ -180,7 +228,7 @@ namespace Cosmos.System.FileSystem
/// Deletes a file.
///
/// The full path.
- ///
+ /// TRUE on success.
public override bool DeleteFile(DirectoryEntry aPath)
{
try
@@ -199,7 +247,7 @@ namespace Cosmos.System.FileSystem
/// Deletes an empty directory.
///
/// The full path.
- ///
+ /// TRUE on success.
public override bool DeleteDirectory(DirectoryEntry aPath)
{
try
@@ -223,7 +271,43 @@ namespace Cosmos.System.FileSystem
/// Gets the directory listing for a path.
///
/// The full path.
- ///
+ /// DirectoryEntry list value.
+ ///
+ ///
+ /// - Thrown if aPath is null or empty.
+ /// - Root path is null or empty.
+ /// - Memory error.
+ /// - Fatal error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown if aFS is null.
+ /// - Root directory is null.
+ /// - Memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when root directory address is smaller then root directory address.
+ /// - Memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when aPath is too deep.
+ /// - Data lenght is greater then Int32.MaxValue.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when unable to determine filesystem for path: + aPath.
+ /// - data size invalid.
+ /// - invalid directory entry type.
+ /// - path not found.
+ ///
+ ///
+ /// Thrown on memory error.
public override List GetDirectoryListing(string aPath)
{
var xFS = GetFileSystemFromPath(aPath);
@@ -235,7 +319,43 @@ namespace Cosmos.System.FileSystem
/// Gets the directory listing for a directory entry.
///
/// The directory entry.
- ///
+ /// DirectoryEntry type list value.
+ ///
+ ///
+ /// - Thrown if aDirectory is null or empty.
+ /// - aDirectory.mFullPath is null or empty.
+ /// - Memory error.
+ /// - Fatal error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown if aFS is null.
+ /// - Root directory is null.
+ /// - Memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when root directory address is smaller then root directory address.
+ /// - Memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when aDirectory.mFullPath is too deep.
+ /// - Data lenght is greater then Int32.MaxValue.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when unable to determine filesystem for path: + aDirectory.mFullPath.
+ /// - data size invalid.
+ /// - invalid directory entry type.
+ /// - path not found.
+ ///
+ ///
+ /// Thrown on memory error.
public override List GetDirectoryListing(DirectoryEntry aDirectory)
{
if (aDirectory == null || String.IsNullOrEmpty(aDirectory.mFullPath))
@@ -300,6 +420,9 @@ namespace Cosmos.System.FileSystem
/// Gets the volumes for all registered file systems.
///
/// A list of directory entries for all volumes.
+ /// Thrown if filesystem is null.
+ /// Thrown when root directory address is smaller then root directory address.
+ /// Thrown when root path is null or empty.
public override List GetVolumes()
{
List xVolumes = new List();
@@ -317,6 +440,10 @@ namespace Cosmos.System.FileSystem
///
/// The volume root path.
/// A directory entry for the volume.
+ /// Thrown when aPath is null or empty.
+ /// Unable to determine filesystem for path: + aPath
+ /// Thrown if filesystem is null.
+ /// Thrown when root directory address is smaller then root directory address.
public override DirectoryEntry GetVolume(string aPath)
{
if (string.IsNullOrEmpty(aPath))
@@ -338,6 +465,43 @@ namespace Cosmos.System.FileSystem
///
/// The path of the File / Directory.
/// The File / Directory attributes.
+ ///
+ ///
+ /// - Thrown if aPath is null or empty.
+ /// - Thrown when aFS root path is null or empty.
+ /// - Thrown on memory error.
+ /// - Fatal error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown if aFS is null.
+ /// - Thrown when root directory is null.
+ /// - Thrown on memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when root directory address is smaller then root directory address.
+ /// - Thrown on memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when aPath is too deep.
+ /// - Thrown when data lenght is greater then Int32.MaxValue.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when data size invalid.
+ /// - Thrown on invalid directory entry type.
+ /// - Thrown when aPath entry not found.
+ /// - Thrown when unable to determine filesystem for path: + aPath.
+ /// - Thrown aPath is neither a file neither a directory.
+ ///
+ ///
+ /// Thrown on memory error.
public override FileAttributes GetFileAttributes(string aPath)
{
/*
@@ -468,6 +632,7 @@ namespace Cosmos.System.FileSystem
///
/// The path.
/// The file system for the path.
+ /// Thrown when aPath is null or empty.
/// Unable to determine filesystem for path: + aPath
private FileSystem GetFileSystemFromPath(string aPath)
{
@@ -507,8 +672,41 @@ namespace Cosmos.System.FileSystem
/// The path.
/// The file system.
/// A directory entry for the path.
- /// aFS
- /// Path part ' + xPathPart + ' not found!
+ ///
+ ///
+ /// - Thrown if aPath is null or empty.
+ /// - Thrown when aFS root path is null or empty.
+ /// - Thrown on memory error.
+ /// - Fatal error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown if aFS is null.
+ /// - Thrown when root directory is null.
+ /// - Thrown on memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when root directory address is smaller then root directory address.
+ /// - Thrown on memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when aPath is too deep.
+ /// - Thrown when data lenght is greater then Int32.MaxValue.
+ ///
+ ///
+ ///
+ ///
+ /// - Thrown when data size invalid.
+ /// - Thrown on invalid directory entry type.
+ /// - Thrown when aPath entry not found.
+ ///
+ ///
+ /// Thrown on memory error.
private DirectoryEntry DoGetDirectoryEntry(string aPath, FileSystem aFS)
{
Global.mFileSystemDebugger.SendInternal("--- CosmosVFS.DoGetDirectoryEntry ---");
@@ -570,6 +768,9 @@ namespace Cosmos.System.FileSystem
///
/// The file system containing the volume.
/// A directory entry for the volume.
+ /// Thrown if aFS is null.
+ /// Thrown when root directory address is smaller then root directory address.
+ /// Thrown when root path is null or empty.
private DirectoryEntry GetVolume(FileSystem aFS)
{
Global.mFileSystemDebugger.SendInternal("--- CosmosVFS.GetVolume ---");
@@ -588,6 +789,7 @@ namespace Cosmos.System.FileSystem
///
/// The id of the drive.
/// true if the drive id is valid, false otherwise.
+ /// Thrown if driveId length is smaller then 2, or greater than Int32.MaxValue.
public override bool IsValidDriveId(string driveId)
{
Global.mFileSystemDebugger.SendInternal($"driveId is {driveId} after normalization");
@@ -607,6 +809,13 @@ namespace Cosmos.System.FileSystem
return isOK;
}
+ ///
+ /// Get total size in bytes.
+ ///
+ /// A drive id to get the size of.
+ /// long value.
+ /// Thrown when aDriveId is null or empty.
+ /// Unable to determine filesystem for path: + aDriveId
public override long GetTotalSize(string aDriveId)
{
var xFs = GetFileSystemFromPath(aDriveId);
@@ -615,6 +824,13 @@ namespace Cosmos.System.FileSystem
return xFs.Size * 1024 * 1024;
}
+ ///
+ /// Get available free space.
+ ///
+ /// A drive id to get the size of.
+ /// long value.
+ /// Thrown when aDriveId is null or empty.
+ /// Unable to determine filesystem for path: + aDriveId
public override long GetAvailableFreeSpace(string aDriveId)
{
var xFs = GetFileSystemFromPath(aDriveId);
@@ -622,6 +838,13 @@ namespace Cosmos.System.FileSystem
return xFs.AvailableFreeSpace;
}
+ ///
+ /// Get total free space.
+ ///
+ /// A drive id to get the size of.
+ /// long value.
+ /// Thrown when aDriveId is null or empty.
+ /// Unable to determine filesystem for path: + aDriveId
public override long GetTotalFreeSpace(string aDriveId)
{
var xFs = GetFileSystemFromPath(aDriveId);
@@ -629,6 +852,13 @@ namespace Cosmos.System.FileSystem
return xFs.TotalFreeSpace;
}
+ ///
+ /// Get file system type.
+ ///
+ /// A drive id.
+ /// string value.
+ /// Thrown when aDriveId is null or empty.
+ /// Unable to determine filesystem for path: + aDriveId
public override string GetFileSystemType(string aDriveId)
{
var xFs = GetFileSystemFromPath(aDriveId);
@@ -636,6 +866,13 @@ namespace Cosmos.System.FileSystem
return xFs.Type;
}
+ ///
+ /// Get file system label.
+ ///
+ /// A drive id.
+ /// string value.
+ /// Thrown when aDriveId is null or empty.
+ /// Unable to determine filesystem for path: + aDriveId
public override string GetFileSystemLabel(string aDriveId)
{
var xFs = GetFileSystemFromPath(aDriveId);
@@ -643,6 +880,13 @@ namespace Cosmos.System.FileSystem
return xFs.Label;
}
+ ///
+ /// Set file system type.
+ ///
+ /// A drive id.
+ /// A label to be set.
+ /// Thrown when aDriveId is null or empty.
+ /// Unable to determine filesystem for path: + aDriveId
public override void SetFileSystemLabel(string aDriveId, string aLabel)
{
Global.mFileSystemDebugger.SendInternal("--- CosmosVFS.SetFileSystemLabel ---");
@@ -652,6 +896,43 @@ namespace Cosmos.System.FileSystem
xFs.Label = aLabel;
}
+ ///
+ /// Format partition.
+ ///
+ /// A drive id.
+ /// A drive format.
+ /// Quick format.
+ ///
+ ///
+ /// - Thrown when the data length is 0 or greater then Int32.MaxValue.
+ /// - Entrys matadata offset value is invalid.
+ /// - Fatal error (contact support).
+ ///
+ ///
+ /// Thrown when filesystem is null / memory error.
+ ///
+ ///
+ /// - Thrown when aDriveId is null or empty.
+ /// - Data length is 0.
+ /// - Root path is null or empty.
+ /// - Memory error.
+ ///
+ ///
+ ///
+ ///
+ /// - Unable to determine filesystem for path: + aDriveId.
+ /// - Thrown when data size invalid.
+ /// - Thrown on unknown file system type.
+ /// - Thrown on fatal error (contact support).
+ ///
+ ///
+ /// Thrown when data lenght is greater then Int32.MaxValue.
+ /// Thrown on memory error.
+ /// Thrown when FAT type is unknown.
+ /// Thrown on fatal error (contact support).
+ /// Thrown on fatal error (contact support).
+ /// Thrown when the data in aData is corrupted.
+ /// Thrown when FAT type is unknown.
public override void Format(string aDriveId, string aDriveFormat, bool aQuick)
{
var xFs = GetFileSystemFromPath(aDriveId);