Interface IFile
Represents a file contained within an IDirectory that could have metadata potentially attached to it by a unique System.Guid that tracks the file within the file system, as long as the Snowflake.Filesystem API methods are used.
Inherited Members
Namespace: Snowflake.Filesystem
Assembly: Snowflake.Framework.Primitives.dll
Syntax
public interface IFile : IReadOnlyFile
Methods
AsReadOnly()
Gets a read-only view over this IFile.
Declaration
IReadOnlyFile AsReadOnly()
Returns
| Type | Description |
|---|---|
| IReadOnlyFile | A read-only view over this IFile. |
Delete()
Deletes a IFile from the underlying file system as well as the manifest of the ParentDirectory.
If Created is false, the file will simply be removed from the manifest.
Declaration
void Delete()
OpenStream()
Opens a read-write stream to the file. If it does not currently exist, it will be created.
Declaration
Stream OpenStream()
Returns
| Type | Description |
|---|---|
| System.IO.Stream | A read-write stream to the file. |
OpenStream(FileAccess)
Opens a stream to the file with the given System.IO.FileAccess. If it does not currently exist, it will be created.
Declaration
Stream OpenStream(FileAccess rw)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.FileAccess | rw | The System.IO.FileAccess permissions to open the stream with. |
Returns
| Type | Description |
|---|---|
| System.IO.Stream | A stream to the file with the given System.IO.FileAccess. |
OpenStream(FileMode, FileAccess, FileShare)
Opens a stream to the file in the specified mode with read, write, or read/write access, and sharing options.
Declaration
Stream OpenStream(FileMode mode, FileAccess rw, FileShare share = FileShare.None)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.FileMode | mode | The mode with which to open the file. |
| System.IO.FileAccess | rw | The System.IO.FileAccess permissions to open the stream with. |
| System.IO.FileShare | share | The sharing mode with which to open the file. |
Returns
| Type | Description |
|---|---|
| System.IO.Stream | A stream to the file with the given System.IO.FileAccess. |
Rename(String)
Renames the file, keeping the same FileGuid. If the provided name is a path, it will be truncated with System.IO.Path.GetFileName(System.String).
To move files between directories, use
Declaration
void Rename(string newName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | newName | The new name of the IFile |