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
Inherited Members
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.
|
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 |
CopyTo(String, Boolean) | Method copies the file to the location denoted by the |
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 |
Open(FileMode) | Method returns an instance of the VFileStream
for the file and required |
Open(FileMode, FileAccess) | Method returns an instance of the VFileStream
for the file, required |
Open(FileMode, FileAccess, FileShare) | Method returns an instance of the VFileStream
for the file, required |
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 |
Replace(String, String, Boolean) | Method copies content of the file to the |
ToString() | Method returns the full path of the directory or file. Inherited from VFileSystemInfo. |