Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SnifferExtensions.cs
1using System.Text;
3
5{
9 public static class SnifferExtensions
10 {
16 public static async Task<string> SnifferToTextAsync(this InMemorySniffer Sniffer)
17 {
18 if (Sniffer is null)
19 return string.Empty;
20
21 StringBuilder sb = new();
22
23 await using StringWriter Writer = new(sb);
24 await using TextWriterSniffer Output = new(Writer, BinaryPresentationMethod.ByteCount, "Text sniffer");
25
26 await Sniffer.FlushAsync();
27
28 Sniffer.Replay(Output);
29
30 await Output.FlushAsync();
31
32 return sb.ToString();
33 }
34 }
35}
Extensions for the ISniffer implementation.
static async Task< string > SnifferToTextAsync(this InMemorySniffer Sniffer)
Converts the latest Xmpp communication that the sniffer holds to plain text.
Sniffer that stores events in memory.
void Replay(CommunicationLayer ComLayer)
Replays sniffer events.
async Task FlushAsync()
Waits until pending sniffer events have been processed.
Definition: SnifferBase.cs:425
Outputs sniffed data to a text writer.
BinaryPresentationMethod
How binary data is to be presented.