Skip to main content

FileManager

class ThaumielMapEditor.API.Helpers

Overview​

Methods​

SignatureReturnsDescription
Dir()stringGets the Thaumiel directory
Dir(string[])stringGets the Thaumiel directory plus the inputed directories
GetFilesInDirectory(string, string)string[]Gets all the file paths in the Thaumiel directory combined with the specified di…
ReadFileInBackground(string, Action<string>)voidReads the specified file at the file path in the background.
TryCreateDirectory(string)voidTries to create a directory with the inputted name
TryCreateDirectory(string[])voidTries to create a directory at the path

Methods​

Dir​

Dir
public string Dir()

Gets the Thaumiel directory

Returns​

string — Directory path to the Thaumiel directory


Dir​

Dir
public string Dir(string[] path)

Gets the Thaumiel directory plus the inputed directories

Parameters​

NameTypeDescription
pathstring[]The path of directories

Returns​

string — Directory path to the Thaumiel directory plus the inputed directories


GetFilesInDirectory​

GetFilesInDirectory
public string[] GetFilesInDirectory(
string name,
string filter
)

Gets all the file paths in the Thaumiel directory combined with the specified directory path.

Parameters​

NameTypeDescription
namestringThe directory path relative to the Thaumiel directory.
filterstringThe search pattern to filter files by. Defaults to * which returns all files.

Returns​

string[] — An array of file paths matching the filter in the resolved directory.


ReadFileInBackground​

ReadFileInBackground
public void ReadFileInBackground(
string path,
Action<string> onComplete
)

Reads the specified file at the file path in the background.

Parameters​

NameTypeDescription
pathstring
onCompleteAction<string>Fired when the reading is complete with the read text

TryCreateDirectory​

TryCreateDirectory
public void TryCreateDirectory(string name)

Tries to create a directory with the inputted name

Parameters​

NameTypeDescription
namestringThe name of the directory

TryCreateDirectory​

TryCreateDirectory
public void TryCreateDirectory(string[] path)

Tries to create a directory at the path

Parameters​

NameTypeDescription
pathstring[]The directory path to make