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> SnifferToText(this InMemorySniffer sniffer)
17 {
18 if (sniffer is null)
19 {
20 return string.Empty;
21 }
22
23 StringBuilder sb = new();
24
25 using (StringWriter writer = new(sb))
26 using (TextWriterSniffer output = new(writer, BinaryPresentationMethod.ByteCount))
27 {
28 await sniffer.ReplayAsync(output);
29 }
30
31 return sb.ToString();
32 }
33 }
34}
Extensions for the ISniffer implementation.
static async Task< string > SnifferToText(this InMemorySniffer sniffer)
Converts the latest Xmpp communication that the sniffer holds to plain text.
Sniffer that stores events in memory.
async Task ReplayAsync(CommunicationLayer ComLayer)
Replays sniffer events.
Outputs sniffed data to a text writer.
BinaryPresentationMethod
How binary data is to be presented.