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 filename. |
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 information.
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 most recently modified time.
Declaration
public override DateTime LastModified { get; }
Property Value
Type | Description |
---|---|
DateTime |
Overrides
NameWithoutExtension
Gets the name without the 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> | An awaitable task returning the resultant file. |
CopyTo(ContentDirectory, string)
Copies the file to 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 ContentFile. |
Delete()
Deletes a file.
Declaration
public override void Delete()
Overrides
GetDataAsync()
Gets the file data.
Declaration
public Task<byte[]> GetDataAsync()
Returns
Type | Description |
---|---|
Task<byte[]> | An awaitable task returning the content as a 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 the operation was successful. |
Overrides
OpenReader()
Opens the file as a 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 | Indicates whether the name change was successful. |
Overrides
SetNameWithoutExtension(string)
Sets a new name for the file without an extension. This will be concatenated with Extension.
Declaration
public bool SetNameWithoutExtension(string newName)
Parameters
Type | Name | Description |
---|---|---|
string | newName | The new name. |
Returns
Type | Description |
---|---|
bool | Indicates whether the change of name was successful. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
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 successful. False otherwise. |