示例#1
0
        /// <summary>
        /// Mounts a path in the OS as an OSFileEntry into the VFS
        /// </summary>
        /// <param name="filePath">The file path of the physical file</param>
        /// <param name="relativePath">The relative path it should be mounted as</param>
        public static void Add(this VirtualFileSystem VFS, string filePath, string relativePath)
        {
            var entry = new OSFileEntry
            {
                Type     = VirtualEntryType.File,
                FilePath = filePath
            };

            VFS.Add(entry, relativePath);
        }
示例#2
0
        /// <summary>
        /// Creates a new OSFileEntry and returns its VfsEntry. This will create a new file on the physical file system and overwrite it with an empty string!
        /// </summary>
        /// <param name="filePath">The file path of the physical file</param>
        /// <param name="relativePath">The relative path it should be mounted as</param>
        public static VfsEntry CreateEntry(this VirtualFileSystem VFS, string filePath, string relativePath)
        {
            var entry = new OSFileEntry
            {
                Type     = VirtualEntryType.File,
                FilePath = filePath
            };

            var vfsEntry = VFS.CreateEntry(entry, relativePath);

            // Write an empty string into the file to already create it on the FS.
            vfsEntry.Write(string.Empty, WriteMode.Overwrite);

            return(vfsEntry);
        }