Class VariableList
Class that allows to easily manage a list of CVar objects.
Inheritance
Inherited Members
Namespace: RuriLib.Models
Assembly: RuriLib.dll
Syntax
public class VariableList
Constructors
| Improve this Doc View SourceVariableList()
Standard constructor that initializes an empty variable list.
Declaration
public VariableList()
VariableList(List<CVar>)
Initializes a variable list starting from an existing list of variables.
Declaration
public VariableList(List<CVar> list)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<CVar> | list | The list of variables. |
Properties
| Improve this Doc View SourceAll
The whole list of variables.
Declaration
public List<CVar> All { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<CVar> |
Captures
The list of all variables marked as Capture.
Declaration
[JsonIgnore]
public List<CVar> Captures { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<CVar> |
Dictionaries
The list of all variables of type Dictionary.
Declaration
[JsonIgnore]
public List<CVar> Dictionaries { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<CVar> |
Lists
The list of all variables of type List.
Declaration
[JsonIgnore]
public List<CVar> Lists { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<CVar> |
Singles
The list of all variables of type Single.
Declaration
[JsonIgnore]
public List<CVar> Singles { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<CVar> |
Methods
| Improve this Doc View SourceGet(String)
Gets a variable given its name.
Declaration
public CVar Get(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the variable |
Returns
Type | Description |
---|---|
CVar | The variable or null if it wasn't found. |
Get(String, CVar.VarType)
Gets a variable given its name and type.
Declaration
public CVar Get(string name, CVar.VarType type)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the variable |
CVar.VarType | type | The type of the variable |
Returns
Type | Description |
---|---|
CVar | The variable or null if it wasn't found. |
GetDictionary(String)
Helper method that gets the value of a variable of type Dictionary.
Declaration
public Dictionary<string, string> GetDictionary(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the Dictionary variable |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | The dictionary value or null if it wasn't found. |
GetList(String)
Helper method that gets the value of a variable of type List.
Declaration
public List<string> GetList(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the List variable |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> | The list of strings value or null if it wasn't found. |
GetSingle(String)
Helper method that gets the value of a variable of type Single.
Declaration
public string GetSingle(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the Single variable |
Returns
Type | Description |
---|---|
System.String | The string value or null if it wasn't found. |
Remove(Condition, String, BotData)
Removes all non-hidden variables if their name matches a condition.
The name of the variables in the list are the left-hand term of the comparison.
Declaration
public void Remove(Condition cond, string name, BotData data)
Parameters
Type | Name | Description |
---|---|---|
Condition | cond | The condition type |
System.String | name | The right-hand term of the comparison |
BotData | data | The BotData object used for variable replacement |
Remove(String)
Removes a non-hidden variable given its name.
Declaration
public void Remove(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the variable to remove |
Set(CVar)
Adds a CVar object to the variable list.
Declaration
public void Set(CVar variable)
Parameters
Type | Name | Description |
---|---|---|
CVar | variable | The CVar object to add |
SetHidden(String, Object)
Adds a hidden CVar object to the variable list.
Declaration
public void SetHidden(string name, dynamic value)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the variable to add |
System.Object | value | The value of the variable to add |
SetNew(CVar)
Adds a CVar object to the variable list only if no other variable with the same name exists.
Declaration
public void SetNew(CVar variable)
Parameters
Type | Name | Description |
---|---|---|
CVar | variable | The CVar object to add |
ToCaptureString()
Generates a string where all the variables marked as Capture are printed in an organized fashion.
Declaration
public string ToCaptureString()
Returns
Type | Description |
---|---|
System.String | The chained capture string. |
VariableExists(String)
Helper method that checks if a variable exists given its name.
Declaration
public bool VariableExists(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the variable |
Returns
Type | Description |
---|---|
System.Boolean | True if the variable exists |
VariableExists(String, CVar.VarType)
Helper method that checks if a variable exists given its name and type.
Declaration
public bool VariableExists(string name, CVar.VarType type)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the variable |
CVar.VarType | type | The type of the variable |
Returns
Type | Description |
---|---|
System.Boolean | True if the variable exists and matches the given type |