Class ValueParser
Inherited Members
Namespace: Xareus.Scenarios
Assembly: Xareus.Scenarios.dll
Syntax
public static class ValueParser
Fields
EVENT_CONTEXT
Declaration
public static readonly string EVENT_CONTEXT
Field Value
Type | Description |
---|---|
string |
EXTERNAL_CONTEXT
Declaration
public static readonly string EXTERNAL_CONTEXT
Field Value
Type | Description |
---|---|
string |
SCENARIO_CONTEXT
Declaration
public static readonly string SCENARIO_CONTEXT
Field Value
Type | Description |
---|---|
string |
SEQUENCE_CONTEXT
Declaration
public static readonly string SEQUENCE_CONTEXT
Field Value
Type | Description |
---|---|
string |
Methods
CanConvertToParameter(Type, ITypeDescriptorContext)
Helper method to check if there is a valid converter from the current type to the Parameter type
Declaration
public static bool CanConvertToParameter(Type type, ITypeDescriptorContext context = null)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The current type to check the conversion to Parameter to |
ITypeDescriptorContext | context |
Returns
Type | Description |
---|---|
bool |
ConvertFromParameter(Parameter, Type, ITypeDescriptorContext)
Helper method to convert a parameter to any other type if possible.
Declaration
public static object ConvertFromParameter(Parameter parameter, Type conversionType, ITypeDescriptorContext context = null)
Parameters
Type | Name | Description |
---|---|---|
Parameter | parameter | The string value to convert |
Type | conversionType | The type to convert the parameter to |
ITypeDescriptorContext | context | An optional context for the converter |
Returns
Type | Description |
---|---|
object |
ConvertFromParameter<T>(Parameter, ITypeDescriptorContext)
Helper method to convert a parameter to any other type if possible.
Declaration
public static T ConvertFromParameter<T>(Parameter parameter, ITypeDescriptorContext context = null)
Parameters
Type | Name | Description |
---|---|---|
Parameter | parameter | the parameter to convert |
ITypeDescriptorContext | context | An optional context for the converter |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | The type to convert to |
ConvertFromString(string, Type, ITypeDescriptorContext)
Helper method to convert a string to any other type if possible.
Declaration
public static object ConvertFromString(string value, Type conversionType, ITypeDescriptorContext context = null)
Parameters
Type | Name | Description |
---|---|---|
string | value | the string value to convert |
Type | conversionType | The type to convert the string to |
ITypeDescriptorContext | context | An optional context for the converter |
Returns
Type | Description |
---|---|
object |
ConvertFromString<T>(string, ITypeDescriptorContext)
Helper method to convert a string to any other type if possible.
Declaration
public static T ConvertFromString<T>(string value, ITypeDescriptorContext context = null)
Parameters
Type | Name | Description |
---|---|---|
string | value | the string value to convert |
ITypeDescriptorContext | context | An optional context for the converter |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | The type to convert to |
ConvertTo(Type, object, ITypeDescriptorContext)
Helper method to convert a type to any other type if possible.
Declaration
public static object ConvertTo(Type typeToConvertTo, object value, ITypeDescriptorContext context = null)
Parameters
Type | Name | Description |
---|---|---|
Type | typeToConvertTo | The current type to check the conversion to Parameter to |
object | value | the value to convert |
ITypeDescriptorContext | context |
Returns
Type | Description |
---|---|
object |
ConvertToParameter(object, Type, ITypeDescriptorContext)
Helper method to convert an object to a parameter if possible
Declaration
public static Parameter ConvertToParameter(object value, Type type, ITypeDescriptorContext context = null)
Parameters
Type | Name | Description |
---|---|---|
object | value | The object value to convert |
Type | type | The type to convert from |
ITypeDescriptorContext | context | An optional context for the converter |
Returns
Type | Description |
---|---|
Parameter |
ConvertToParameter<T>(T, ITypeDescriptorContext)
Helper method to convert an object to a parameter if possible
Declaration
public static Parameter ConvertToParameter<T>(T value, ITypeDescriptorContext context = null)
Parameters
Type | Name | Description |
---|---|---|
T | value | The object value to convert |
ITypeDescriptorContext | context | An optional context for the converter |
Returns
Type | Description |
---|---|
Parameter |
Type Parameters
Name | Description |
---|---|
T | The type to convert from |
ConvertToString<T>(T, ITypeDescriptorContext)
Helper method to convert an object to a string if possible
Declaration
public static string ConvertToString<T>(T value, ITypeDescriptorContext context = null)
Parameters
Type | Name | Description |
---|---|---|
T | value | The object value to convert |
ITypeDescriptorContext | context | An optional context for the converter |
Returns
Type | Description |
---|---|
string |
Type Parameters
Name | Description |
---|---|
T | The type to convert from |
ConvertTo<T>(object, ITypeDescriptorContext)
Helper method to convert a type to any other type if possible.
Declaration
public static T ConvertTo<T>(object value, ITypeDescriptorContext context = null)
Parameters
Type | Name | Description |
---|---|---|
object | value | the value to convert |
ITypeDescriptorContext | context |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | The type to convert to |
GetContext(ref string, object, object, object, object)
Declaration
[Obsolete("Use GetContext(ref string, IContext, IContext, IContext, IContext) instead")]
public static object GetContext(ref string path, object externalContext, object scenarioContext, object sequenceContext, object eventContext)
Parameters
Type | Name | Description |
---|---|---|
string | path | |
object | externalContext | |
object | scenarioContext | |
object | sequenceContext | |
object | eventContext |
Returns
Type | Description |
---|---|
object |
GetContext(ref string, IContext, IContext, IContext, IContext)
Declaration
public static IContext GetContext(ref string path, IContext externalContext, IContext scenarioContext, IContext sequenceContext, IContext eventContext)
Parameters
Type | Name | Description |
---|---|---|
string | path | |
IContext | externalContext | |
IContext | scenarioContext | |
IContext | sequenceContext | |
IContext | eventContext |
Returns
Type | Description |
---|---|
IContext |
Parse(string, object, object, object, object)
Declaration
[Obsolete("Use Parse(string, IContext, IContext, IContext, IContext) instead")]
public static object Parse(string value, object externalContext, object scenarioContext, object sequenceContext, object eventContext)
Parameters
Type | Name | Description |
---|---|---|
string | value | |
object | externalContext | |
object | scenarioContext | |
object | sequenceContext | |
object | eventContext |
Returns
Type | Description |
---|---|
object |
Parse(string, string, object, object, object, object)
Declaration
[Obsolete("Use Parse(string, string, IContext, IContext, IContext, IContext) instead")]
public static object Parse(string valueType, string value, object externalContext, object scenarioContext, object sequenceContext, object eventContext)
Parameters
Type | Name | Description |
---|---|---|
string | valueType | |
string | value | |
object | externalContext | |
object | scenarioContext | |
object | sequenceContext | |
object | eventContext |
Returns
Type | Description |
---|---|
object |
Parse(string, string, IContext, IContext, IContext, IContext)
Converts a value according to the rules listed bellow (precedence matters).
$(ANYCONTEXT.<path>?.<key>)
recovers the value from the given context in the given path.
Use everydefined parser to try to convert the value
<float>
is converted to a float.
<string>
is the initial value.
Declaration
public static object Parse(string valueType, string value, IContext externalContext, IContext scenarioContext, IContext sequenceContext, IContext eventContext)
Parameters
Type | Name | Description |
---|---|---|
string | valueType | The type of the value |
string | value | The value |
IContext | externalContext | The external context |
IContext | scenarioContext | The scenario context |
IContext | sequenceContext | The context conveyed by the sequence |
IContext | eventContext | The context in which the event was triggered |
Returns
Type | Description |
---|---|
object | The conversion. The context can be returned if not path is specified |
Parse(string, IContext, IContext, IContext, IContext)
Converts a value according to the rules listed bellow (precedence matters).
$(ANYCONTEXT.<path>?.<key>)
recovers the value from the given context in the given path.
Use everydefined parser to try to convert the value
<float>
is converted to a float.
<string>
is the initial value.
Declaration
public static object Parse(string value, IContext externalContext, IContext scenarioContext, IContext sequenceContext, IContext eventContext)
Parameters
Type | Name | Description |
---|---|---|
string | value | The value |
IContext | externalContext | The external context |
IContext | scenarioContext | The scenario context |
IContext | sequenceContext | The context conveyed by the sequence |
IContext | eventContext | The context in which the event was triggered |
Returns
Type | Description |
---|---|
object | The conversion. The context can be returned if not path is specified |
Parse(Type, string, object, object, object, object)
Declaration
[Obsolete("Use Parse(Type, string, IContext, IContext, IContext, IContext) instead")]
public static object Parse(Type valueType, string value, object externalContext, object scenarioContext, object sequenceContext, object eventContext)
Parameters
Type | Name | Description |
---|---|---|
Type | valueType | |
string | value | |
object | externalContext | |
object | scenarioContext | |
object | sequenceContext | |
object | eventContext |
Returns
Type | Description |
---|---|
object |
Parse(Type, string, IContext, IContext, IContext, IContext)
Converts a value according to the rules listed bellow (precedence matters).
$(ANYCONTEXT.<path>?.<key>)
recovers the value from the given context in the given path.
Use everydefined parser to try to convert the value
<float>
is converted to a float.
<string>
is the initial value.
Declaration
public static object Parse(Type valueType, string value, IContext externalContext, IContext scenarioContext, IContext sequenceContext, IContext eventContext)
Parameters
Type | Name | Description |
---|---|---|
Type | valueType | The type of the value |
string | value | The value |
IContext | externalContext | The external context |
IContext | scenarioContext | The scenario context |
IContext | sequenceContext | The context conveyed by the sequence |
IContext | eventContext | The context in which the event was triggered |
Returns
Type | Description |
---|---|
object | The conversion. The context can be returned if no path is specified |
Parse(Type, Parameter, object, object, object, object)
Declaration
[Obsolete("Use Parse(Type, Parameter, IContext, IContext, IContext, IContext) instead")]
public static object Parse(Type valueType, Parameter parameter, object externalContext, object scenarioContext, object sequenceContext, object eventContext)
Parameters
Type | Name | Description |
---|---|---|
Type | valueType | |
Parameter | parameter | |
object | externalContext | |
object | scenarioContext | |
object | sequenceContext | |
object | eventContext |
Returns
Type | Description |
---|---|
object |
Parse(Type, Parameter, IContext, IContext, IContext, IContext)
Parses a parameter into an object. If the parameter contains a value field, then a string parse occurs
Declaration
public static object Parse(Type valueType, Parameter parameter, IContext externalContext, IContext scenarioContext, IContext sequenceContext, IContext eventContext)
Parameters
Type | Name | Description |
---|---|---|
Type | valueType | The type of the value |
Parameter | parameter | The parameter holding the values |
IContext | externalContext | The external context |
IContext | scenarioContext | The scenario context |
IContext | sequenceContext | The context conveyed by the sequence |
IContext | eventContext | The context in which the event was triggered |
Returns
Type | Description |
---|---|
object | The conversion. The context can be returned if no path is specified |
ParseScenario(string, object, object, object, object)
Declaration
[Obsolete("Use ParseScenario(string, string, IContext, IContext, IContext, IContext) instead")]
public static Scenario ParseScenario(string value, object externalContext, object scenarioContext, object sequenceContext, object eventContext)
Parameters
Type | Name | Description |
---|---|---|
string | value | |
object | externalContext | |
object | scenarioContext | |
object | sequenceContext | |
object | eventContext |
Returns
Type | Description |
---|---|
Scenario |
ParseScenario(string, IContext, IContext, IContext, IContext)
Declaration
public static Scenario ParseScenario(string value, IContext externalContext, IContext scenarioContext, IContext sequenceContext, IContext eventContext)
Parameters
Type | Name | Description |
---|---|---|
string | value | |
IContext | externalContext | |
IContext | scenarioContext | |
IContext | sequenceContext | |
IContext | eventContext |
Returns
Type | Description |
---|---|
Scenario |
Parse<T>(string, object, object, object, object)
Declaration
[Obsolete("Use Parse<T>(string, string, IContext, IContext, IContext, IContext) instead")]
public static T Parse<T>(string value, object externalContext, object scenarioContext, object sequenceContext, object eventContext)
Parameters
Type | Name | Description |
---|---|---|
string | value | |
object | externalContext | |
object | scenarioContext | |
object | sequenceContext | |
object | eventContext |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Parse<T>(string, IContext, IContext, IContext, IContext)
Converts a value according to the rules listed bellow (precedence matters).
$(ANYCONTEXT.<path>?.<key>)
recovers the value from the given context in the given path.
Use everydefined parser to try to convert the value
<float>
is converted to a float.
<string>
is the initial value.
Declaration
public static T Parse<T>(string value, IContext externalContext, IContext scenarioContext, IContext sequenceContext, IContext eventContext)
Parameters
Type | Name | Description |
---|---|---|
string | value | The value |
IContext | externalContext | The external context |
IContext | scenarioContext | The scenario context |
IContext | sequenceContext | The context conveyed by the sequence |
IContext | eventContext | The context in which the event was triggered |
Returns
Type | Description |
---|---|
T | The conversion |
Type Parameters
Name | Description |
---|---|
T |
SetValue<T>(string, T, object, object, object, object)
Declaration
[Obsolete("Use SetValue(string, T, IContext, IContext, IContext) instead")]
public static bool SetValue<T>(string path, T value, object externalContext, object scenarioContext, object sequenceContext, object eventContext = null)
Parameters
Type | Name | Description |
---|---|---|
string | path | |
T | value | |
object | externalContext | |
object | scenarioContext | |
object | sequenceContext | |
object | eventContext |
Returns
Type | Description |
---|---|
bool |
Type Parameters
Name | Description |
---|---|
T |
SetValue<T>(string, T, IContext, IContext, IContext, IContext)
Sets a value in one of the contexts
Declaration
public static bool SetValue<T>(string path, T value, IContext externalContext, IContext scenarioContext, IContext sequenceContext, IContext eventContext = null)
Parameters
Type | Name | Description |
---|---|---|
string | path | |
T | value | |
IContext | externalContext | |
IContext | scenarioContext | |
IContext | sequenceContext | |
IContext | eventContext |
Returns
Type | Description |
---|---|
bool |
Type Parameters
Name | Description |
---|---|
T |