![]() |
BadScript 2
|
Public Api for the Settings System. More...
Public Member Functions | |
BadSettings (string sourcePath) | |
Creates a new empty Settings Object. | |
BadSettings (JToken? value, string sourcePath) | |
Creates a new Settings Object from a Json Token. | |
BadSettings (Dictionary< string, BadSettings > properties, string sourcePath) | |
Creates a new Settings Object from a Dictionary of Properties. | |
JToken? | GetValue () |
Returns the Json Token of the Settings Object. | |
T? | GetValue< T > () |
Returns a Deserialized Value of the Settings Object. | |
bool | HasValue () |
Returns true if the Settings Object has a JToken Value. | |
void | SetValue (JToken? value, bool invokeOnChange=true) |
Sets the Json Token of the Current Settings Object. | |
bool | HasProperty (string propertyName) |
Returns true if the Settings Object has the given Property. | |
BadSettings | GetProperty (string propertyName) |
Returns the Property with the given Name. | |
void | SetProperty (string propertyName, BadSettings value, bool invokeOnChange=true) |
Sets the Property with the given Name. | |
bool | RemoveProperty (string propertyName, bool invokeOnChange=true) |
Removes the Property with the given Name. | |
void | Populate (bool invokeOnChanged, params BadSettings[] settings) |
Populates the current object with the settings provided. | |
T? | FindProperty< T > (string propertyName) |
Finds a property based on the property path relative to this object. | |
BadSettings | FindOrCreateProperty (string propertyPath) |
Finds a property based on the property path relative to this object. | |
BadSettings? | FindProperty (string propertyPath) |
Finds a property based on the property path relative to this object. | |
override string | ToString () |
Returns a string representation of the current object. | |
Static Public Member Functions | |
static void | ResolveEnvironmentVariables (BadSettings root) |
Resolves Environment Variables in the current object. | |
static void | ResolveEnvironmentVariables (BadSettings root, BadSettings settings, BadSettings parent) |
Resolves Environment Variables in the current object. | |
Properties | |
bool | HasSourcePath [get] |
string | SourcePath [get] |
IEnumerable< string > | PropertyNames [get] |
The Property Names of the Settings Object. | |
Events | |
Action | OnValueChanged = delegate { } |
Private Member Functions | |
void | PropertyValueChanged () |
void | InvokeValueChanged () |
bool | HasValue< T > () |
Returns true if the Settings Object can be Deserialized into the given Type. | |
void | SetValue (object? value) |
Sets the Json Token of the Current Settings Object. | |
Static Private Member Functions | |
static string | ResolveEnvironmentVariables (BadSettings root, BadSettings parent, string str) |
Resolves Environment Variables in the current object. | |
Private Attributes | |
readonly Dictionary< string, BadSettings > | m_Properties |
The properties of the Current Settings Object. | |
readonly string | m_SourcePath |
The Source Path of the Settings Object. | |
object? | m_Cache |
Cache for the Serialized Value of the Settings. | |
bool | m_IsDirty |
Indicates if the current object is dirty and needs to be re-serialized. | |
JToken? | m_Value |
The Json Token of the Settings Object. | |
Public Api for the Settings System.
Definition at line 10 of file BadSettings.cs.
BadScript2.Settings.BadSettings.BadSettings | ( | string | sourcePath | ) |
Creates a new empty Settings Object.
sourcePath | The Source Path of the Settings Object |
Definition at line 44 of file BadSettings.cs.
BadScript2.Settings.BadSettings.BadSettings | ( | JToken? | value, |
string | sourcePath | ||
) |
Creates a new Settings Object from a Json Token.
value | The Json Token |
sourcePath | The Source Path of the Settings Object |
Definition at line 57 of file BadSettings.cs.
BadScript2.Settings.BadSettings.BadSettings | ( | Dictionary< string, BadSettings > | properties, |
string | sourcePath | ||
) |
Creates a new Settings Object from a Dictionary of Properties.
properties | The Properties |
sourcePath | The Source Path of the Settings Object |
Definition at line 70 of file BadSettings.cs.
BadSettings BadScript2.Settings.BadSettings.FindOrCreateProperty | ( | string | propertyPath | ) |
Finds a property based on the property path relative to this object.
propertyPath | Property Path |
Definition at line 329 of file BadSettings.cs.
BadSettings? BadScript2.Settings.BadSettings.FindProperty | ( | string | propertyPath | ) |
Finds a property based on the property path relative to this object.
propertyPath | Property Path |
Definition at line 356 of file BadSettings.cs.
T? BadScript2.Settings.BadSettings.FindProperty< T > | ( | string | propertyName | ) |
Finds a property based on the property path relative to this object.
propertyName | Property Path |
T | Type to deserialize into |
T | : | class |
Definition at line 317 of file BadSettings.cs.
BadSettings BadScript2.Settings.BadSettings.GetProperty | ( | string | propertyName | ) |
Returns the Property with the given Name.
propertyName | The Property Name |
Definition at line 200 of file BadSettings.cs.
JToken? BadScript2.Settings.BadSettings.GetValue | ( | ) |
Returns the Json Token of the Settings Object.
Definition at line 104 of file BadSettings.cs.
T? BadScript2.Settings.BadSettings.GetValue< T > | ( | ) |
Returns a Deserialized Value of the Settings Object.
T | The Type to Deserialize into |
Definition at line 114 of file BadSettings.cs.
bool BadScript2.Settings.BadSettings.HasProperty | ( | string | propertyName | ) |
Returns true if the Settings Object has the given Property.
propertyName | The Property Name |
Definition at line 190 of file BadSettings.cs.
bool BadScript2.Settings.BadSettings.HasValue | ( | ) |
Returns true if the Settings Object has a JToken Value.
Definition at line 138 of file BadSettings.cs.
|
private |
Returns true if the Settings Object can be Deserialized into the given Type.
T | The Type |
Definition at line 148 of file BadSettings.cs.
|
private |
Definition at line 95 of file BadSettings.cs.
void BadScript2.Settings.BadSettings.Populate | ( | bool | invokeOnChanged, |
params BadSettings[] | settings | ||
) |
Populates the current object with the settings provided.
invokeOnChanged | Indicates if the OnChanged Event should be invoked |
settings | The settings this object will be populated with |
Definition at line 261 of file BadSettings.cs.
|
private |
Definition at line 89 of file BadSettings.cs.
bool BadScript2.Settings.BadSettings.RemoveProperty | ( | string | propertyName, |
bool | invokeOnChange = true |
||
) |
Removes the Property with the given Name.
propertyName | The Property Name |
invokeOnChange | Indicates if the OnChange Event should be invoked |
Definition at line 234 of file BadSettings.cs.
|
static |
Resolves Environment Variables in the current object.
root | The Root settings |
Definition at line 453 of file BadSettings.cs.
|
staticprivate |
Resolves Environment Variables in the current object.
root | The Root settings |
parent | The Parent Object |
str | The String to Expand |
Exception | Gets raised if the environment variable syntax is invalid or the environment variable is not found |
Definition at line 412 of file BadSettings.cs.
|
static |
Resolves Environment Variables in the current object.
root | The Root settings |
settings | The Current Settings Object |
parent | The Parent Object |
Definition at line 464 of file BadSettings.cs.
void BadScript2.Settings.BadSettings.SetProperty | ( | string | propertyName, |
BadSettings | value, | ||
bool | invokeOnChange = true |
||
) |
Sets the Property with the given Name.
propertyName | The Property Name |
value | The Property Value |
invokeOnChange | Indicates if the OnChange Event should be invoked |
Definition at line 211 of file BadSettings.cs.
void BadScript2.Settings.BadSettings.SetValue | ( | JToken? | value, |
bool | invokeOnChange = true |
||
) |
Sets the Json Token of the Current Settings Object.
value | Json Token |
invokeOnChange | Indicates if the OnChange Event should be invoked |
Definition at line 163 of file BadSettings.cs.
|
private |
Sets the Json Token of the Current Settings Object.
value | The Deserialized Object |
Definition at line 180 of file BadSettings.cs.
override string BadScript2.Settings.BadSettings.ToString | ( | ) |
Returns a string representation of the current object.
Definition at line 378 of file BadSettings.cs.
|
private |
Cache for the Serialized Value of the Settings.
Definition at line 28 of file BadSettings.cs.
|
private |
Indicates if the current object is dirty and needs to be re-serialized.
Definition at line 33 of file BadSettings.cs.
|
private |
The properties of the Current Settings Object.
Definition at line 15 of file BadSettings.cs.
|
private |
The Source Path of the Settings Object.
Definition at line 20 of file BadSettings.cs.
|
private |
The Json Token of the Settings Object.
Definition at line 38 of file BadSettings.cs.
|
get |
Definition at line 22 of file BadSettings.cs.
|
get |
The Property Names of the Settings Object.
Definition at line 85 of file BadSettings.cs.
|
get |
Definition at line 23 of file BadSettings.cs.
Action BadScript2.Settings.BadSettings.OnValueChanged = delegate { } |
Definition at line 87 of file BadSettings.cs.