Table of Contents

Class Folder

Namespace
Cobilas.GodotEngine.Utility.IO
Assembly
com.cobilas.godot.utility.dll

A representation of a system folder.

public class Folder : DataBase, IDisposable, IFormattable, IEnumerable<DataBase>, IEnumerable
Inheritance
Folder
Implements
Inherited Members

Constructors

Folder(DataBase?, string?, ArchiveAttributes)

Creates a new instance of this object.

public Folder(DataBase? parent, string? dataName, ArchiveAttributes attributes)

Parameters

parent DataBase
dataName string
attributes ArchiveAttributes

Properties

Attributes

The attributes of the data file.

public override ArchiveAttributes Attributes { get; protected set; }

Property Value

ArchiveAttributes

Returns the attributes of the data file.

Name

Data file name.

public override string? Name { get; protected set; }

Property Value

string

Returns a string containing the name of the data file.

Null

A null representation of the Folder object.

public static Folder Null { get; }

Property Value

Folder

Returns a null representation of the Folder object.

Parent

The parent element of the data file.

public override DataBase? Parent { get; protected set; }

Property Value

DataBase

Returns parent element of data file.

Path

The full path of the data file.

public override string Path { get; }

Property Value

string

Returns a string containing the full path of the data file.

Methods

ArchiveExists(string)

Checks if a file exists.

public bool ArchiveExists(string archiveName)

Parameters

archiveName string

The name of the archive.

Returns

bool

Returns true when the specified element exists.

Create(string?)

Creates a new instance containing a specified directory.

public static Folder Create(string? path)

Parameters

path string

The path that will be instantiated.

Returns

Folder

Returns the representation of a folder.

Exceptions

ArgumentNullException

Occurs if the path parameter is null.

CreateArchive(string?)

Allows you to create a new file in the current folder.

public Archive CreateArchive(string? fileName)

Parameters

fileName string

The name of this new file.

Returns

Archive

Returns the new file that was created in the current folder.

Exceptions

ReadOnlyException

Will occur if the method is called on an object that is marked as read-only.

ArgumentNullException

Occurs if the fileName parameter is null.

InvalidOperationException

Occurs when the name of the new file has an invalid character.

CreateFolder(string?, bool)

Allows the creation of a new folder in the current folder.

public Folder CreateFolder(string? folderName, bool recursive = false)

Parameters

folderName string

The name of the new folder.

recursive bool

Allows the creation of a folder within another in a cascade fashion. (exp: Folder1/Folder2/Folder3/Folder4)

Returns

Folder

Returns the newly created folder.

Exceptions

ArgumentNullException

Occurs if the folderName parameter is null.

CreateRes()

Creates a new instance containing a representation of the res:// folder.

public static Folder CreateRes()

Returns

Folder

Returns the representation of a folder.

Exceptions

ArgumentNullException

Occurs if the path parameter is null.

CreateUser()

Creates a new instance containing a representation of the user:// folder.

public static Folder CreateUser()

Returns

Folder

Returns the representation of a folder.

Exceptions

ArgumentNullException

Occurs if the path parameter is null.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public override void Dispose()

FolderExists(string)

Checks if a folder exists.

public bool FolderExists(string folderName)

Parameters

folderName string

The name of the folder.

Returns

bool

Returns true when the specified element exists.

GetArchive(string?, bool)

Gets the target archive from the current folder.

public Archive GetArchive(string? fileName, bool recursive = false)

Parameters

fileName string

The name of the archive.

recursive bool

Allows you to get a specified archive in the current folder or its subfolders

Returns

Archive

Returns the specified archive. If not found, a null representation will be returned.

GetArchives(bool)

Gets the target archive from the current folder.

public Archive[]? GetArchives(bool recursive = false)

Parameters

recursive bool

Allows you to get a specified archive in the current folder or its subfolders

Returns

Archive[]

Returns the specified archive. If not found, a null representation will be returned.

GetArchives(string?, bool)

Gets all archives in the current folder.

public Archive[]? GetArchives(string? search, bool recursive = false)

Parameters

search string

Allows you to collect specific files. Use '|' to separate search conditions. (exp:".jpeg|.png|.txt")

recursive bool

Allows you to get a specified archives in the current folder or its subfolders.

Returns

Archive[]

Returns a list of all archives in the current folder.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<DataBase> GetEnumerator()

Returns

IEnumerator<DataBase>

An enumerator that can be used to iterate through the collection.

GetFolder(string?, bool)

Gets the target folder from the current folder.

public Folder GetFolder(string? folderName, bool recursive = false)

Parameters

folderName string

The name of the folder.

recursive bool

Allows you to get a specified folder in the current folder or its subfolders.

Returns

Folder

Returns the specified folder. If not found, a null representation will be returned.

GetFolders()

Gets all folders in the current folder.

public Folder[]? GetFolders()

Returns

Folder[]

Returns a list of all folders in the current folder.

RemoveArchive(string?)

Allows you to remove a file in the current folder.

public bool RemoveArchive(string? archiveName)

Parameters

archiveName string

The name of the archive.

Returns

bool

Returns true when the remove operation is successful.

Exceptions

ReadOnlyException

Will occur if the method is called on an object that is marked as read-only.

ArgumentNullException

Occurs if the archiveName parameter is null.

RemoveFolder(string?)

Allows the removal of a folder.

public bool RemoveFolder(string? folderName)

Parameters

folderName string

The name of the folder.

Returns

bool

Returns true when the remove operation is successful.

Exceptions

ReadOnlyException

Will occur if the method is called on an object that is marked as read-only.

ArgumentNullException

Occurs if the folderName parameter is null.

RenameArchive(string?, string?)

Allows renaming of a file in the current folder.

public bool RenameArchive(string? oldName, string? newName)

Parameters

oldName string

The name of the archive.

newName string

The new name of the archive.

Returns

bool

Returns true when the rename operation was successful.

Exceptions

ReadOnlyException

Will occur if the method is called on an object that is marked as read-only.

ArgumentNullException

Occurs if the oldName parameter is null.

ArgumentNullException

Occurs if the newName parameter is null.

InvalidOperationException

Occurs when the name of the new file has an invalid character.

RenameFolder(string?, string?)

Allows you to rename the folder.

public bool RenameFolder(string? oldName, string? newName)

Parameters

oldName string

The name of the folder.

newName string

The new name of the folder.

Returns

bool

Returns true when the rename operation was successful.

Exceptions

ReadOnlyException

Will occur if the method is called on an object that is marked as read-only.

ArgumentNullException

Occurs if the oldName parameter is null.

ArgumentNullException

Occurs if the newName parameter is null.

InvalidOperationException

Occurs when the name of the new file has an invalid character.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

ToString(bool)

Returns a string that represents the current object.

public string ToString(bool recursive)

Parameters

recursive bool

Returns

string

A string that represents the current object.

ToString(string, IFormatProvider)

Formats the value of the current instance using the specified format.

public override string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format to use.-or- A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation.

formatProvider IFormatProvider

The provider to use to format the value.-or- A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system.

Returns

string

The value of the current instance in the specified format.