3using System.Threading.Tasks;
22 private readonly SortedDictionary<string, IElement> content =
new SortedDictionary<string, IElement>();
24 private readonly
string threadId;
25 private readonly
int expectedSources;
26 private object tag =
null;
52 get => this.expectedSources;
61 set => this.tag = value;
71 string[] Result =
new string[this.content.Count];
72 this.content.Keys.CopyTo(Result, 0);
73 return Task.FromResult<
string[]>(Result);
83 return Task.FromResult<
int>(this.content.Count);
116 public Task<bool>
Add(
string Source,
string Text)
118 return this.
Add(Source, Text,
string.Empty);
128 public Task<bool>
Add(
string Source,
string Text,
string Id)
130 return this.
Add(Source, Text, Id,
false);
152 public Task<bool>
Update(
string Source,
string Text,
string Id)
154 return this.
Add(Source, Text, Id,
true);
157 private async Task<bool>
Add(
string Source,
string Text,
string _,
bool Update)
165 if (!(Exp.
Root is
null))
166 Content = await Exp.
Root.EvaluateAsync(this.variables);
190 LinkedList<IDisposableAsync> ToDispose =
null;
194 if (this.content.ContainsKey(Source))
197 this.content[Source] = Content;
200 ToDispose ??=
new LinkedList<IDisposableAsync>();
201 ToDispose.AddLast(DisposableAsync);
203 else if (Content is IDisposable Disposable)
204 Disposable.Dispose();
210 this.content[Source] = Content;
215 if (!(ToDispose is
null))
221 EventHandlerAsync<SourceEventArgs> h =
Update ? this.Updated : this.
Added;
230 [Obsolete(
"Use DisposeAsync() instead.")]
248 return this.
Disposed.Raise(
this, EventArgs.Empty,
false);
254 public event EventHandlerAsync<SourceEventArgs>
Added =
null;
259 public event EventHandlerAsync<SourceEventArgs>
Updated =
null;
272 LinkedList<IElement> Elements =
new LinkedList<IElement>();
276 foreach (KeyValuePair<string, IElement> P
in this.content)
281 Elements.AddLast(this.Append(E, P.Key));
284 Elements.AddLast(this.Append(P.Value, P.Key));
297 GenObj[
"Source"] = Source;
300 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 SessionVariables CreateSessionVariables()
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.
Exception used to break a loop.
Exception used to continue a loop.
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.
Interface for asynchronously disposable objects.
Task DisposeAsync()
Disposes of the object, asynchronously.
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.