Skip to content

Catalog (CTS)

Mariusz edited this page May 1, 2020 · 2 revisions

The Catalog class is the core class of the CTS system. For more info on how to use it, see CTS (Save Load System).

Public Methods

void Apply()

Applies all changes made to the Catalog to it's file.

void CancelOverride()

Cancels a previously applied override.

Variable Find(Predicate<Variable>)

Returns the first variable which meets the given condition.

IReadOnlyList<Variable> GetAllLines()

Returns all variables of the given catalog.

string GetCategoryEnd()

Returns the string which is used for the beginning of it's wrapper.

string GetCategoryStart()

Returns the string which is used for the end of it's wrapper.

int GetCount()

Returns the count of all variables inside the given catalog.

int GetIndex(string)

Returns the index of a given variable inside the collection. Returns -1 if none were found.

string GetSafe(string, string)

Attempts to find and return the value of a given variable by name; If none were found, it returns the second argument given.

bool Move(string, int)

Attempts to move a variable under the given name to the given index. Returns true if attempt was successful.

void OrderBy(Func<Variable, int>)

Orders the list by a given key selector.

void Override(List<Variable>)

Overrides all existing variables with a new list.

void Refresh()

Refreshes the catalog to be up-to-date on it's file. (Resets ALL variable changes made to it in the process)

bool Remove(string)

Attempts to remove a variable by name.

bool Remove(Variable)

Attempts to remove a variable.

void RemoveAll()

Removes all variables.

int RemoveAll(Predicate<Variable>)

Removes all variables that match the given condition.

bool Rename(string, string)

Renames an existing variable to another name.

void Reset()

Reverts ALL changes that were made to the given catalog.

Public Fields/Properties/Constants

const string SV_VARIABLE_POINTER = " IS "

The string value used to separate the name of a variable from it's value.

const char SV_CATEGORY_WRAP_BEGIN = '['

Indicates the start of a category line.

const char SV_CATEGORY_WRAP_END = ']'

Indicates the end of a category line.

const char SVARV_CATEGORY_END = '/'

Indicates a wrapper-closing category line.

static readonly Regex Expression_Category_Start

A regular expression to match a Category Start line.

static readonly Regex Expression_Category_End

A regular expression to match a Category End line.

static readonly Regex Expression_Variable

A regular expression to match a variable line.

Clone this wiki locally