static void TestVirtualFileSystem() { try { Random r = new Random(); SlowDisk disk = new SlowDisk(1); disk.TurnOn(); VirtualFS vfs = new VirtualFS(); vfs.Format(disk); vfs.Mount(disk, "/"); VirtualNode root = vfs.RootNode; VirtualNode dir1 = root.CreateDirectoryNode("dir1"); VirtualNode dir2 = root.CreateDirectoryNode("dir2"); VirtualNode file1 = dir1.CreateFileNode("file1"); TestFileWriteRead(file1, r, 0, 100); TestFileWriteRead(file1, r, 0, 500); TestFileWriteRead(file1, r, 250, 100); vfs.Unmount("/"); vfs.Mount(disk, "/"); RescursivelyPrintNodes(vfs.RootNode); disk.TurnOff(); } catch (Exception ex) { Console.WriteLine("VFS test failed: " + ex.Message); } }
public void Unmount(string mountPoint) { mVirtualFileSystem.Unmount(mountPoint); }