Class ContentDirectory
The content directory class.
Namespace: Evergine.Assets.Contents
Assembly: Evergine.Assets.dll
Syntax
public class ContentDirectory : ContentElement
Constructors
ContentDirectory(string)
Initializes a new instance of the ContentDirectory class.
Declaration
public ContentDirectory(string rootDirectory)
Parameters
Type | Name | Description |
---|---|---|
string | rootDirectory | The root directory. |
ContentDirectory(string, ContentDirectory)
Initializes a new instance of the ContentDirectory class.
Declaration
public ContentDirectory(string directoryName, ContentDirectory parentDirectory)
Parameters
Type | Name | Description |
---|---|---|
string | directoryName | The directory name. |
ContentDirectory | parentDirectory | The parent directory. |
Properties
DirectoryInfo
Gets the directory information.
Declaration
public DirectoryInfo DirectoryInfo { get; }
Property Value
Type | Description |
---|---|
DirectoryInfo |
DirtyPath
Gets or sets a value indicating whether the path is marked as dirty and needs to be recalculated.
Declaration
public override bool DirtyPath { get; set; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Files
Gets the files in the directory.
Declaration
public ConcurrentDictionary<string, ContentFile> Files { get; }
Property Value
Type | Description |
---|---|
ConcurrentDictionary<string, ContentFile> |
FullPath
Gets the full content 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
SubDirectories
Gets the subdirectories of the directory.
Declaration
public ConcurrentDictionary<string, ContentDirectory> SubDirectories { get; }
Property Value
Type | Description |
---|---|
ConcurrentDictionary<string, ContentDirectory> |
Methods
ContainsDirectory(string)
Checks if the directory contains a specified directory.
Declaration
public bool ContainsDirectory(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the directory to search for. |
Returns
Type | Description |
---|---|
bool | True if it exists; false otherwise. |
ContainsElement(string)
Checks if the directory contains a defined element.
Declaration
public bool ContainsElement(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the element to search for. |
Returns
Type | Description |
---|---|
bool | True if it exists; false otherwise. |
ContainsFile(string)
Checks if the directory contains a specified file.
Declaration
public bool ContainsFile(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the file to search for. |
Returns
Type | Description |
---|---|
bool | True if the file exists; false otherwise. |
CreateContentFile(string, out ContentFile)
Creates a subdirectory.
Declaration
public FileStream CreateContentFile(string fileName, out ContentFile file)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | The name of the subdirectory. |
ContentFile | file | The content file. |
Returns
Type | Description |
---|---|
FileStream | The write stream. |
CreateSubDirectory(string)
Creates a subdirectory.
Declaration
public ContentDirectory CreateSubDirectory(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the subdirectory. |
Returns
Type | Description |
---|---|
ContentDirectory | The content directory object. |
Delete()
Deletes an element.
Declaration
public override void Delete()
Overrides
FindDirectoryByName(string)
Gets a subdirectory contained in the directory by its name.
Declaration
public ContentDirectory FindDirectoryByName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the directory to search. |
Returns
Type | Description |
---|---|
ContentDirectory | The directory if it exists; Null otherwise. |
FindFileByName(string)
Gets a file contained in the directory by its name.
Declaration
public ContentFile FindFileByName(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the file to search for. |
Returns
Type | Description |
---|---|
ContentFile | The file if it exists; null otherwise. |
FindFilesByExtension(IEnumerable<string>)
Gets all the files in the directory with a specific set of extensions.
Declaration
public List<ContentFile> FindFilesByExtension(IEnumerable<string> extensions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | extensions | The collection of extensions. |
Returns
Type | Description |
---|---|
List<ContentFile> | A list of files that match the specified extensions. |
FindFilesByExtension(string)
Gets all the files in the directory with a specific extension.
Declaration
public List<ContentFile> FindFilesByExtension(string extension)
Parameters
Type | Name | Description |
---|---|---|
string | extension | The extension. |
Returns
Type | Description |
---|---|
List<ContentFile> | A list of the files. |
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
Refresh()
Refreshes the element, setting its path to dirty mode.
Declaration
public override void Refresh()
Overrides
SetName(string)
Sets the name of the element.
Declaration
public override bool SetName(string newName)
Parameters
Type | Name | Description |
---|---|---|
string | newName | The new name of the element. |
Returns
Type | Description |
---|---|
bool | True if it is possible to change its name. |
Overrides
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. |