2using System.Threading.Tasks;
68 public override Task
Parse(XmlElement Xml)
73 return base.Parse(Xml);
83 if (this.actionRef.
IsConstant && !
this.actionRef.IsEmpty && !Machine.
TryGetAction(
this.actionRef.Definition, out _))
84 throw new Exception(
"Action not found: " + this.actionRef.
Definition);
86 base.CheckReferences(Machine,
Token);
96 return this.actionRef?.
Evaluate(Arguments.
Variables) ?? Task.FromResult<
string>(
null);
107 if (
string.IsNullOrEmpty(ActionId))
108 return TimeSpan.Zero;
110 DateTime Start = DateTime.UtcNow;
112 TimeSpan Elapsed = DateTime.UtcNow.Subtract(Start);
122 ArchiveRequired = Arguments.Machine.ArchiveRequired
145 if (!
string.IsNullOrEmpty(ActionId))
148 throw new Exception(
"Action not found: " + ActionId);
155 if (this.beforeActionScript?.HasExpreession ??
false)
Helps with common XML-related tasks.
static string Attribute(XmlElement E, string Name)
Gets the value of an XML attribute.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
ProfilerThread GetThread(string Name, ProfilerThreadType Type)
Gets a profiler thread. If none is available, a new is created.
Class that keeps track of events and timing for one thread.
void Low()
Sets the (binary) state to "low".
void High()
Sets the (binary) state to "high".
override async Task Execute(EvaluationArguments Arguments)
Evaluates the action node
Represents an action definition.
Abstract base class for nodes referencing an action.
string BeforeActionScript
Script executed before action.
async Task< TimeSpan > ExecuteLog(EvaluationArguments Arguments)
Evaluates an action, and logs the time the action took as a sample value.
bool HasActionReference
If event has an action reference.
override Task Parse(XmlElement Xml)
Parses the State-machine node.
async Task ExecuteNoLog(string ActionId, EvaluationArguments Arguments)
Evaluates an action, without logging the time the action took as a sample value.
ActionReference()
Abstract base class for nodes referencing an action.
string ActionReferenceDefinition
Action Reference
bool HasExpressionActionReference
If event has an action reference defined in an expression.
Task< string > GetReference(EvaluationArguments Arguments)
Evaluates the reference.
override void CheckReferences(StateMachine Machine, Token Token)
Checks references in the node.
async Task ExecuteNoLog(EvaluationArguments Arguments)
Evaluates an action, without logging the time the action took as a sample value.
bool HasConstantActionReference
If event has a constant action reference.
Attribute containing a script expression.
async Task< object > Evaluate(Variables Variables)
Evaluates the attribute
string Expression
Expression
bool IsEmpty
If the definition is empty.
bool IsExpression
If the attribute value is an expression.
async Task< T > Evaluate(Variables Variables)
Evaluates the attribute
bool IsConstant
If the attribute value is a constant.
string Definition
Attribute definition
Scriptable string attribute.
Contains information required for evaluating script in a state-machine.
StateMachine Machine
Reference to state-machine definition.
Profiler Profiler
State-Machine profiler.
Variables Variables
Current set of variables.
Abstract base class for State-Machine nodes.
Variable definition in a State-Machine
Class representing a state machine.
bool TryGetAction(string Id, out Model.Actions.Action Action)
Tries to get an action.
CaseInsensitiveString StateMachineId
ID of State Machine.
Duration? ArchiveOptional
Duration after which token expires, and the required archiving time, the token can optionally be arch...
DateTime Expires
When state-machine expires
Class representing a sample of a state machine variable over time.
ProfilerThreadType
Type of profiler thread.