2using System.Collections.Generic;
3using System.Threading.Tasks;
18 private readonly LinkedList<KeyValuePair<string, object>> currentProperties =
new LinkedList<KeyValuePair<string, object>>();
19 private readonly List<KeyValuePair<string, ScriptNode>> additionalFields;
22 private readonly
Variables contextVariables;
23 private readonly
Variables entryVariables;
24 private readonly
Variable variableObjectId;
25 private readonly
Variable variableTypeName;
26 private readonly
Variable variableEntryType;
27 private readonly
Variable variableTimestamp;
28 private readonly
Variable variableBlockId;
29 private readonly
Variable variableCollection;
30 private string currentObjectId;
31 private string currentTypeName;
33 private DateTimeOffset currentEntryTimestamp;
43 List<KeyValuePair<string, ScriptNode>> AdditionalFields)
46 this.condition = Condition;
48 this.additionalFields = AdditionalFields;
52 this.contextVariables);
56 ContextVariables = this.properties,
57 ConsoleOut = Variables.ConsoleOut
60 this.variableObjectId = this.entryVariables.
Add(
"ObjectId", this.currentObjectId);
61 this.variableTypeName = this.entryVariables.Add(
"TypeName", this.currentTypeName);
62 this.variableEntryType = this.entryVariables.Add(
"EntryType", this.currentEntryType);
63 this.variableTimestamp = this.entryVariables.Add(
"Timestamp", this.currentEntryTimestamp);
64 this.variableBlockId = this.entryVariables.Add(
"BlockId", this.
StartedBlock);
65 this.variableCollection = this.entryVariables.Add(
"Collection", this.
StartedCollection);
80 this.variableCollection.SetValue(CollectionName);
82 return base.StartCollection(CollectionName);
92 this.variableBlockId.SetValue(BlockID);
94 return base.StartBlock(BlockID);
105 this.entryVariables[Key] = Value;
107 return base.BlockMetaData(Key, Value);
120 this.currentObjectId = ObjectId;
121 this.currentTypeName = TypeName;
123 this.currentEntryTimestamp = EntryTimestamp;
125 this.variableObjectId.SetValue(this.currentObjectId);
126 this.variableTypeName.SetValue(this.currentTypeName);
127 this.variableEntryType.SetValue(this.currentEntryType);
128 this.variableTimestamp.SetValue(this.currentEntryTimestamp);
130 this.currentProperties.Clear();
132 return Task.FromResult(
true);
141 public override Task<bool>
ReportProperty(
string PropertyName,
object PropertyValue)
143 this.currentProperties.AddLast(
new KeyValuePair<string, object>(PropertyName, PropertyValue));
144 return Task.FromResult(
true);
153 if (!Guid.TryParse(
this.currentObjectId, out Guid ObjectId))
154 ObjectId = Guid.Empty;
157 this.currentTypeName, ObjectId, this.currentProperties);
159 if (!(this.additionalFields is
null))
161 foreach (KeyValuePair<string, ScriptNode> P
in this.additionalFields)
167 if (P.Value.IsAsynchronous)
168 E = await P.Value.EvaluateAsync(this.entryVariables);
170 E = P.Value.Evaluate(this.entryVariables);
181 this.entryVariables[P.Key] = E;
186 if (!(this.condition is
null))
192 if (this.condition.IsAsynchronous)
193 E = await this.condition.EvaluateAsync(this.entryVariables);
195 E = this.condition.Evaluate(this.entryVariables);
206 if (!await base.StartEntry(
this.currentObjectId,
this.currentTypeName,
this.currentEntryType,
this.currentEntryTimestamp))
209 foreach (KeyValuePair<string, object> P
in this.currentProperties)
211 if (!await base.ReportProperty(P.Key, P.Value))
215 if (!await base.EndEntry())
Generic object. Contains a sequence of properties.
Script runtime exception.
IElement ReturnValue
Return value.
Base class for all nodes in a parsed script tree.
Abstract base class for ledger exports with custom entry filter rules.
string StartedBlock
Block that is currently being processed.
string StartedCollection
Collection that is currently being processed.
Only exports entries matching a given condition (or conditions)
override Task< bool > StartCollection(string CollectionName)
Is called when a collection is started.
override Task< bool > StartBlock(string BlockID)
Is called when a block in a collection is started.
ExportCondition(ILedgerExport Output, ScriptNode Condition, Variables Variables, List< KeyValuePair< string, ScriptNode > > AdditionalFields)
Only exports entries matching a given condition (or conditions)
Variables EntryVariables
Entry variables.
override Task< bool > ReportProperty(string PropertyName, object PropertyValue)
Is called when a property is reported.
override async Task< bool > EndEntry()
Is called when an entry is finished.
override Task< bool > BlockMetaData(string Key, object Value)
Reports block meta-data.
override bool IncludeNonEntryEvent()
If a non-entry event should be included.
override Task< bool > StartEntry(string ObjectId, string TypeName, EntryType EntryType, DateTimeOffset EntryTimestamp)
Is called when an entry is started.
override bool IncludeEntry(string ObjectId, string TypeName, EntryType EntryType, DateTimeOffset EntryTimestamp)
If an entry should be included.
Contains information about a variable.
virtual Variable Add(string Name, object Value)
Adds a variable to the collection.
Interface for ledger exports.
Basic interface for all types of elements.
object AssociatedObjectValue
Associated object value.
EntryType
Ledger entry type.