Class ContentFile
The content file class.
Inherited Members
Namespace: Evergine.Assets.Contents
Assembly: Evergine.Assets.dll
Syntax
public class ContentFile : ContentElement
Constructors
ContentFile(string, ContentDirectory)
Initializes a new instance of the ContentFile class.
Declaration
public ContentFile(string fileName, ContentDirectory parentDirectory)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | The file name. |
ContentDirectory | parentDirectory | The parent directory. |
Properties
Extension
Gets the file extension.
Declaration
public string Extension { get; }
Property Value
Type | Description |
---|---|
string |
FileInfo
Gets the file info.
Declaration
public FileInfo FileInfo { get; }
Property Value
Type | Description |
---|---|
FileInfo |
FullPath
Gets the full path.
Declaration
public override string FullPath { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
LastModified
Gets the latest modified time.
Declaration
public override DateTime LastModified { get; }
Property Value
Type | Description |
---|---|
DateTime |
Overrides
NameWithoutExtension
Gets the name without extension.
Declaration
public string NameWithoutExtension { get; }
Property Value
Type | Description |
---|---|
string |
Methods
CopyTo(ContentDirectory)
Copies the file to another directory.
Declaration
public Task<ContentFile> CopyTo(ContentDirectory targetDirectory)
Parameters
Type | Name | Description |
---|---|---|
ContentDirectory | targetDirectory | The destination directory. |
Returns
Type | Description |
---|---|
Task<ContentFile> | Awaitable task returning the result file. |
CopyTo(ContentDirectory, string)
Copies the file into another directory.
Declaration
public Task<ContentFile> CopyTo(ContentDirectory destinationDirectory, string newName)
Parameters
Type | Name | Description |
---|---|---|
ContentDirectory | destinationDirectory | The destination directory. |
string | newName | The new name of the file. |
Returns
Type | Description |
---|---|
Task<ContentFile> | Awaitable task of the operation, returning the new Content File. |
Delete()
Deletes the file.
Declaration
public override void Delete()
Overrides
GetDataAsync()
Gets the file data.
Declaration
public Task<byte[]> GetDataAsync()
Returns
Type | Description |
---|---|
Task<byte[]> | Awaitable task of the operation returning its content as byte array. |
Move(ContentDirectory)
Moves the element to a new directory.
Declaration
public override bool Move(ContentDirectory newParentDirectory)
Parameters
Type | Name | Description |
---|---|---|
ContentDirectory | newParentDirectory | The new parent Content Directory. |
Returns
Type | Description |
---|---|
bool | True if it was successful. |
Overrides
OpenReader()
Opens the file as reader.
Declaration
public FileStream OpenReader()
Returns
Type | Description |
---|---|
FileStream | The File Stream of the file. |
OpenWrite()
Opens the file for writing.
Declaration
public FileStream OpenWrite()
Returns
Type | Description |
---|---|
FileStream | The FileStream of the file. |
Refresh()
Refreshes the element, setting its path to dirty mode.
Declaration
public override void Refresh()
Overrides
SetName(string)
Sets a new name for the file.
Declaration
public override bool SetName(string newName)
Parameters
Type | Name | Description |
---|---|---|
string | newName | The new name. |
Returns
Type | Description |
---|---|
bool | If the change of name could be achieved. |
Overrides
SetNameWithoutExtension(string)
Sets a new name for the file without extension.
Declaration
public bool SetNameWithoutExtension(string newName)
Parameters
Type | Name | Description |
---|---|---|
string | newName | The new name. |
Returns
Type | Description |
---|---|
bool | If the change of name could be achieved. |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Overrides
UpdateName(string)
Updates the name of the element.
Declaration
public override bool UpdateName(string newName)
Parameters
Type | Name | Description |
---|---|---|
string | newName | The new name of the element. |
Returns
Type | Description |
---|---|
bool | True if the operation was succesful. False otherwise. |