Rebex
Products Downloads Buy Support Contact
Show / Hide Table of Contents

VFileInfo Class

Namespace: Rebex.IO
Assembly: Rebex.FileSystem.dll (version 7.0.9119)

Class represents a file in the virtual file system. This class provides properties and methods that are functionally similar to the standard .NET FileInfo properties and methods.

Syntax
public sealed class VFileInfo : VFileSystemInfo
Inheritance
Object
VFileSystemInfo
VFileInfo
Inherited Members
VFileSystemInfo.Attributes
VFileSystemInfo.CreationTime
VFileSystemInfo.CreationTimeUtc
VFileSystemInfo.Exists
VFileSystemInfo.Extension
VFileSystemInfo.FullName
VFileSystemInfo.FullPath
VFileSystemInfo.LastAccessTime
VFileSystemInfo.LastAccessTimeUtc
VFileSystemInfo.LastWriteTime
VFileSystemInfo.LastWriteTimeUtc
VFileSystemInfo.Name
VFileSystemInfo.OriginalPath
VFileSystemInfo.Refresh()
VFileSystemInfo.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Examples
//Create a built-in or custom VFS provider 
var memoryProvider = new MemoryFileSystemProvider()
//Save the root path
var memoryProviderRootPath = memoryProvider.GetRootVDirectoryInfo().FullName;
//Create a path to the new 'myFile.txt' file.
var myFileTxtPath = Path.Combine(memoryProviderRootPath, "myFile.txt");
//Create 'myFile.txt' file and open it for writing
using (var currentTxtFile = new VFileInfo(myFileTxtPath).CreateText())
{
    //Write a line to the file.
    currentTxtFile.WriteLine("My content");
}

Constructors

Name Description
VFileInfo(String)

Initializes a new instance of the VFileInfo.

Fields

Name Description
FullPath

Full path of the node. Inherited from VFileSystemInfo.

OriginalPath

Original path of the node. This path contains only '/' separator even in case a user provides an original path with '' separator. Inherited from VFileSystemInfo.

Properties

Name Description
Attributes

Gets or sets the attributes for the file or directory. Inherited from VFileSystemInfo.

CreationTime

Gets or sets the creation date and time for the file or directory. Inherited from VFileSystemInfo.

CreationTimeUtc

Gets or sets the creation date and time for the file or directory. The time is expressed in the UTC format. Inherited from VFileSystemInfo.

DirectoryName

Gets the full path of the parent directory of this file.

Exists

Method returns true when the file or directory exists; otherwise returns false. Inherited from VFileSystemInfo.

Extension

Gets the extension of the file. Inherited from VFileSystemInfo.

FullName

Gets the full path of the file. Inherited from VFileSystemInfo.

IsReadOnly

Gets or sets whether this file is read-only.

LastAccessTime

Gets or sets the last access date and time for the file or directory. Inherited from VFileSystemInfo.

LastAccessTimeUtc

Gets or sets the last access date and time for the file or directory. The time is expressed in the UTC format. Inherited from VFileSystemInfo.

LastWriteTime

Gets or sets the last write date and time for the file or directory. Inherited from VFileSystemInfo.

LastWriteTimeUtc

Gets or sets the last write date and time for the file or directory. The time is expressed in the UTC format. Inherited from VFileSystemInfo.

Length

Gets the length, in bytes, of the file.

Name

Gets the name of the file or directory. Inherited from VFileSystemInfo.

VDirectory

Gets an instance of the VDirectoryInfo class that represents the parent of this file.

Methods

Name Description
AppendText()

Method returns an instance of the StreamWriter for the file.

CopyTo(String)

Method copies the file to the location denoted by the destFileName.

CopyTo(String, Boolean)

Method copies the file to the location denoted by the destFileName.

Create()

Method returns read/write instance of the VFileStream for the file. A caller must dispose the returned stream to ensure that the data written to the stream are persisted.

CreateText()

Method returns StreamWriter for the file. A caller must dispose the returned StreamWriter to ensure that the data written to the StreamWriter are persisted.

Delete()

Method deletes the file.

MoveTo(String)

Method moves the file to the location denoted by the destFileName.

Open(FileMode)

Method returns an instance of the VFileStream for the file and required mode. A caller must dispose the returned stream.

Open(FileMode, FileAccess)

Method returns an instance of the VFileStream for the file, required mode and requested access. A caller must dispose the returned stream.

Open(FileMode, FileAccess, FileShare)

Method returns an instance of the VFileStream for the file, required mode and requested access. A caller must dispose the returned stream.

OpenRead()

Method returns an instance of the read-only VFileStream. A caller must dispose the returned stream. Calling the method is equivalent to calling the method Open(FileMode, FileAccess) with arguments Open(FileMode.Open, FileAccess.Read).

OpenText()

Method returns an instance of the StreamReader for the file. A caller must dispose the returned StreamWriter.

OpenWrite()

Method returns an instance of the write-only VFileStream for the file. A caller must dispose the returned stream. Calling the method is equivalent to calling the method Open(FileMode, FileAccess) with arguments Open(FileMode.OpenOrCreate, FileAccess.Write).

Refresh()

Method tries to refresh values of properties in this instance. Inherited from VFileSystemInfo.

Replace(String, String)

Method copies content of the file to the destinationFileName and deletes this file. In other words, content of the destinationFileName is replaced by the content of this file. When the destinationBackupFileName is not null then the original (to be replaced) content of the destinationFileName is stored in the destinationBackupFileName.

Replace(String, String, Boolean)

Method copies content of the file to the destinationFileName and deletes this file. In other words, content of the destinationFileName is replaced by the content of this file. When the destinationBackupFileName is not null then the original (to be replaced) content of the destinationFileName is stored in the destinationBackupFileName.

ToString()

Method returns the full path of the directory or file. Inherited from VFileSystemInfo.

Extension Methods

VFileInfoExtensions.AsFileNode(VFileInfo)

See Also

VDirectoryInfo
VDirectory
VFile
MemoryFileSystemProvider
LocalFileSystemProvider
MountCapableFileSystemProvider
ReadWriteFileSystemProvider
ReadOnlyFileSystemProvider
In This Article
  • Constructors
  • Fields
  • Properties
  • Methods
  • Extension Methods
  • See Also
© REBEX ČR s.r.o. Back to top
Privacy policy
Manage cookies