3using System.Threading.Tasks;
23 private readonly
Variables contextVariables;
24 private readonly
Variables entryVariables;
25 private readonly
Variable variableObjectId;
26 private readonly
Variable variableTypeName;
27 private readonly
Variable variableEntryType;
28 private readonly
Variable variableTimestamp;
29 private readonly
Variable variableBlockId;
30 private readonly
Variable variableCollection;
31 private string currentObjectId;
32 private string currentTypeName;
34 private DateTimeOffset currentEntryTimestamp;
44 ChunkedList<KeyValuePair<string, ScriptNode>> AdditionalFields)
47 this.condition = Condition;
49 this.additionalFields = AdditionalFields;
53 this.contextVariables);
57 ContextVariables = this.properties,
58 ConsoleOut = Variables.ConsoleOut
61 this.variableObjectId = this.entryVariables.
Add(
"ObjectId", this.currentObjectId);
62 this.variableTypeName = this.entryVariables.Add(
"TypeName", this.currentTypeName);
63 this.variableEntryType = this.entryVariables.Add(
"EntryType", this.currentEntryType);
64 this.variableTimestamp = this.entryVariables.Add(
"Timestamp", this.currentEntryTimestamp);
65 this.variableBlockId = this.entryVariables.Add(
"BlockId", this.
StartedBlock);
66 this.variableCollection = this.entryVariables.Add(
"Collection", this.
StartedCollection);
81 this.variableCollection.SetValue(CollectionName);
83 return base.StartCollection(CollectionName);
93 this.variableBlockId.SetValue(BlockID);
95 return base.StartBlock(BlockID);
106 this.entryVariables[Key] = Value;
108 return base.BlockMetaData(Key, Value);
121 this.currentObjectId = ObjectId;
122 this.currentTypeName = TypeName;
124 this.currentEntryTimestamp = EntryTimestamp;
126 this.variableObjectId.SetValue(this.currentObjectId);
127 this.variableTypeName.SetValue(this.currentTypeName);
128 this.variableEntryType.SetValue(this.currentEntryType);
129 this.variableTimestamp.SetValue(this.currentEntryTimestamp);
131 this.currentProperties.Clear();
133 return Task.FromResult(
true);
142 public override Task<bool>
ReportProperty(
string PropertyName,
object PropertyValue)
144 this.currentProperties.Add(
new KeyValuePair<string, object>(PropertyName, PropertyValue));
145 return Task.FromResult(
true);
154 if (!Guid.TryParse(
this.currentObjectId, out Guid ObjectId))
155 ObjectId = Guid.Empty;
158 this.currentTypeName, ObjectId, this.currentProperties);
160 if (!(this.additionalFields is
null))
162 foreach (KeyValuePair<string, ScriptNode> P
in this.additionalFields)
168 if (P.Value.IsAsynchronous)
169 E = await P.Value.EvaluateAsync(this.entryVariables);
171 E = P.Value.Evaluate(this.entryVariables);
193 this.entryVariables[P.Key] = E;
198 if (!(this.condition is
null))
204 if (this.condition.IsAsynchronous)
205 E = await this.condition.EvaluateAsync(this.entryVariables);
207 E = this.condition.Evaluate(this.entryVariables);
218 if (!await base.StartEntry(
this.currentObjectId,
this.currentTypeName,
this.currentEntryType,
this.currentEntryTimestamp))
221 foreach (KeyValuePair<string, object> P
in this.currentProperties)
223 if (!await base.ReportProperty(P.Key, P.Value))
227 if (!await base.EndEntry())
Generic object. Contains a sequence of properties.
A chunked list is a linked list of chunks of objects of type T .
Exception used to break a loop.
Exception used to continue a loop.
Script runtime exception.
IElement ReturnValue
Return value.
Base class for all nodes in a parsed script tree.
static readonly ObjectValue Null
Null value.
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.
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.
ExportCondition(ILedgerExport Output, ScriptNode Condition, Variables Variables, ChunkedList< KeyValuePair< string, ScriptNode > > AdditionalFields)
Only exports entries matching a given condition (or conditions)
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.