diff --git a/Docs/articles/System/images/File System Files List.PNG b/Docs/articles/System/images/File System Files List.PNG new file mode 100644 index 000000000..1644158ae Binary files /dev/null and b/Docs/articles/System/images/File System Files List.PNG differ diff --git a/Docs/articles/System/images/File System Free Space.PNG b/Docs/articles/System/images/File System Free Space.PNG new file mode 100644 index 000000000..a640fbdc0 Binary files /dev/null and b/Docs/articles/System/images/File System Free Space.PNG differ diff --git a/Docs/articles/System/images/File System Initialize.PNG b/Docs/articles/System/images/File System Initialize.PNG new file mode 100644 index 000000000..1def4875e Binary files /dev/null and b/Docs/articles/System/images/File System Initialize.PNG differ diff --git a/Docs/articles/System/images/File System Read File.PNG b/Docs/articles/System/images/File System Read File.PNG new file mode 100644 index 000000000..653487acb Binary files /dev/null and b/Docs/articles/System/images/File System Read File.PNG differ diff --git a/Docs/articles/System/images/File System Type.PNG b/Docs/articles/System/images/File System Type.PNG new file mode 100644 index 000000000..91ee1d9f2 Binary files /dev/null and b/Docs/articles/System/images/File System Type.PNG differ diff --git a/Docs/articles/System/index.txt b/Docs/articles/System/index.txt new file mode 100644 index 000000000..c1df8b379 --- /dev/null +++ b/Docs/articles/System/index.txt @@ -0,0 +1,57 @@ +In this articel we will discuss about using Cosmos VFS (virtual file system). +Cosmos VFS and the VFS manager classes, let you manage your file system. + +First, we should create and initialize an instance of the VFS; +``` +var fs = new Sys.FileSystem.CosmosVFS(); +fs.Initialize(); +``` +What is done here is that the partitions and file systems list is being initialized, and the file system is being registered. +Right after this lines is done, an message looking like this will apper on your screen: + +///////////////////////////////// INITIALIZE. + +This message is printed by the initialize method and it provide info about the file system. + +After our VFS has been initialized, we can use more interesting functions, lets go over some of them: + +1. Get available free space. +``` +long available_space = fs.GetAvailableFreeSpace("0:/"); +Console.WriteLine("Available Free Space: " + available_space); +``` +We use this function to get the size of the available free space in our file system, in bytes. +You have probably noticed the "0:/" argument passed to this function, this is the id of the drive we want to get available free space of. +Cosmos using DOS drive naming system and this is why we use "0". + +///////////////////////////////// FREE SPACE. + +2. Get file system type. +``` +string fs_type = fs.GetFileSystemType("0:/"); +Console.WriteLine("File System Type: " + fs_type); +``` +This will let us know what the file system type. + +///////////////////////////////// TYPE. + +3. Get files list. +We start by getting the directory entrys list, using: +``` +var directory_list = fs.GetDirectoryListing("0:/"); +``` +Once we have it, we can get the names of our files: +``` +foreach (var directoryEntry in directory_list) +{ + Console.WriteLine(directoryEntry.mName); +} +``` + +///////////////////////////////// FILES LIST. + +4. Read files. +This one is more tricky, +We need to get a directoryEntryList, find files in the list and print the content to the screen. + +///////////////////////////////// READ. \ No newline at end of file