2using System.Collections.Generic;
3using System.Threading.Tasks;
23 private readonly SortedDictionary<string, IElement> content =
new SortedDictionary<string, IElement>();
25 private readonly
string threadId;
26 private readonly
int expectedSources;
27 private object tag =
null;
53 get => this.expectedSources;
62 set => this.tag = value;
72 string[] Result =
new string[this.content.Count];
73 this.content.Keys.CopyTo(Result, 0);
74 return Task.FromResult<
string[]>(Result);
84 return Task.FromResult<
int>(this.content.Count);
117 public Task<bool>
Add(
string Source,
string Text)
119 return this.
Add(Source, Text,
string.Empty);
129 public Task<bool>
Add(
string Source,
string Text,
string Id)
131 return this.
Add(Source, Text, Id,
false);
153 public Task<bool>
Update(
string Source,
string Text,
string Id)
155 return this.
Add(Source, Text, Id,
true);
158 private async Task<bool>
Add(
string Source,
string Text,
string _,
bool Update)
166 if (!(Exp.
Root is
null))
167 Content = await Exp.
Root.EvaluateAsync(this.variables);
182 if (this.content.ContainsKey(Source))
185 this.content[Source] = Content;
186 else if (Content is IDisposable Disposable)
187 Disposable.Dispose();
193 this.content[Source] = Content;
198 EventHandlerAsync<SourceEventArgs> h =
Update ? this.Updated : this.
Added;
207 [Obsolete(
"Use DisposeAsync() instead.")]
225 return this.
Disposed.Raise(
this, EventArgs.Empty,
false);
231 public event EventHandlerAsync<SourceEventArgs>
Added =
null;
236 public event EventHandlerAsync<SourceEventArgs>
Updated =
null;
249 LinkedList<IElement> Elements =
new LinkedList<IElement>();
253 foreach (KeyValuePair<string, IElement> P
in this.content)
258 Elements.AddLast(this.Append(E, P.Key));
261 Elements.AddLast(this.Append(P.Value, P.Key));
274 GenObj[
"Source"] = Source;
277 else if (Obj is IDictionary<string, IElement> ObjExNihilo)
Event arguments for source events.
Contains a markdown document. This markdown document class supports original markdown,...
Task< string > GenerateMarkdown()
Generates Markdown from the markdown text.
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Implements an HTTP server.
static Variables CreateVariables()
Creates a new collection of variables, that contains access to the global set of variables.
Generic object. Contains a sequence of properties.
Base class for all types of elements.
abstract object AssociatedObjectValue
Associated object value.
Script runtime exception.
IElement ReturnValue
Return value.
Class managing a script expression.
ScriptNode Root
Root script node.
static readonly ObjectValue Null
Null value.
static IElement Encapsulate(Array Elements, bool CanEncapsulateAsMatrix, ScriptNode Node)
Encapsulates the elements of a vector.
Consolidates responses from occupants in a MUC room.
Task< string[]> GetSources()
Consolidated sources.
EventHandlerAsync Disposed
Event raised when consolidator has been disposed.
async Task< bool > Add(string Source, MarkdownDocument Markdown, string Id)
Adds incoming markdown information.
int ExpectedSources
Expected number of sources that will respond.
EventHandlerAsync< SourceEventArgs > Added
Event raised when content from a source has been added.
async Task< bool > Add(string Source, MarkdownDocument Markdown)
Adds incoming markdown information.
Task DisposeAsync()
IDisposable.Dispose
Task< bool > Add(string Source, string Text)
Adds incoming markdown information.
EventHandlerAsync< SourceEventArgs > Updated
Event raised when content from a source has been updated.
void Dispose()
IDisposable.Dispose
ScriptConsolidator(string ThreadId, int ExpectedSources)
Consolidates responses from occupants in a MUC room.
Task< int > GetNrReportedSources()
Number of sources that have reported content.
IVector GetResult()
Gets the result from all sources.
object Tag
External tag object that can be tagged to the object by its owner.
Task< bool > Update(string Source, string Text, string Id)
Updates incoming markdown information.
Task< bool > Add(string Source, string Text, string Id)
Adds incoming markdown information.
async Task< bool > Update(string Source, MarkdownDocument Markdown, string Id)
Updates incoming markdown information.
Interface for consolidators.
Basic interface for all types of elements.
ICollection< IElement > ChildElements
An enumeration of child elements. If the element is a scalar, this property will return null.
Basic interface for vectors.
delegate Task EventHandlerAsync(object Sender, EventArgs e)
Asynchronous version of EventArgs.