Exemplo n.º 1
0
        /// <summary>
        /// Mounts a new file system.
        /// </summary>
        /// <param name="source">The source of the filesystem. This is usually a device name, but can also be another directory.</param>
        /// <param name="target">The path including the name of the mount point, where to mount the new filesystem.</param>
        public static void Mount(string source, string target)
        {
            // Retrieve the parent directory of the mount
            DirectoryEntry parent = PathResolver.Resolve(rootNode, ref target, PathResolutionFlags.RetrieveParent);

            if (parent == null)
            {
                throw new System.ArgumentException();
            }

            IFileSystem root = FileSystemFactory.CreateFileSystem(source);

            if (root == null)
            {
                throw new System.ArgumentException();
            }

            PathSplitter path = new PathSplitter(target);

            DirectoryEntry.Allocate(parent, path.Last, root.Root);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Mounts a new file system.
        /// </summary>
        /// <param name="source">The source of the filesystem. This is usually a device name, but can also be another directory.</param>
        /// <param name="target">The path including the name of the mount point, where to mount the new filesystem.</param>
        public static void Mount(string source, string target)
        {
            // Retrieve the parent directory of the mount
            DirectoryEntry parent = PathResolver.Resolve(rootNode, ref target, PathResolutionFlags.RetrieveParent);

            if (parent == null)
                throw new System.ArgumentException();

            IFileSystem root = FileSystemFactory.CreateFileSystem(source);

            if (root == null)
                throw new System.ArgumentException();

            PathSplitter path = new PathSplitter(target);
            DirectoryEntry.Allocate(parent, path.Last, root.Root);
        }