Class ContentDirectory
The content directory class.
Inherited Members
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 parent 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 info.
Declaration
public DirectoryInfo DirectoryInfo { get; }
Property Value
Type | Description |
---|---|
DirectoryInfo |
DirtyPath
Gets or sets a value indicating whether the path is dirty and needs to be recalculated.
Declaration
public override bool DirtyPath { get; set; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Files
Gets the files of the directory.
Declaration
public ConcurrentDictionary<string, ContentFile> Files { get; }
Property Value
Type | Description |
---|---|
ConcurrentDictionary<string, ContentFile> |
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
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 defined directory.
Declaration
public bool ContainsDirectory(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the directory to search. |
Returns
Type | Description |
---|---|
bool | True if 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. |
Returns
Type | Description |
---|---|
bool | True if exists. False otherwise. |
ContainsFile(string)
Checks if the directory contains a defined file.
Declaration
public bool ContainsFile(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the file to search. |
Returns
Type | Description |
---|---|
bool | True if exists. False otherwise. |
CreateContentFile(string, out ContentFile)
Creates a sub directory.
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 sub directory.
Declaration
public ContentDirectory CreateSubDirectory(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the subdirectory. |
Returns
Type | Description |
---|---|
ContentDirectory | The contentDirectory object. |
Delete()
Deletes the file.
Declaration
public override void Delete()
Overrides
FindDirectoryByName(string)
Gets a sub directory 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 exists. False 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. |
Returns
Type | Description |
---|---|
ContentFile | The file if exists. False otherwise. |
FindFilesByExtension(IEnumerable<string>)
Gets all the files of the directory with a specific set of extensions.
Declaration
public List<ContentFile> FindFilesByExtension(IEnumerable<string> extensions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<string> | extensions | The extension enumerable. |
Returns
Type | Description |
---|---|
List<ContentFile> | The list of the files that satisfy the extensions. |
FindFilesByExtension(string)
Gets all the files of 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> | The 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 it was successful. |
Overrides
Refresh()
Refreshes the element, setting its path to dirty mode.
Declaration
public override void Refresh()
Overrides
SetName(string)
Sets a new name for the directory.
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
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. |