cs-codex-dist-tests/Tools/TranscriptAnalysis/Receivers/LogReplaceReceiver.cs

32 lines
849 B
C#
Raw Permalink Normal View History

2024-08-07 09:18:40 +00:00
using CodexPlugin;
using CodexPlugin.OverwatchSupport;
using OverwatchTranscript;
namespace TranscriptAnalysis.Receivers
{
public class LogReplaceReceiver : BaseReceiver<OverwatchCodexEvent>
{
public override string Name => "LogReplacer";
private readonly List<string> seen = new List<string>();
public override void Receive(ActivateEvent<OverwatchCodexEvent> @event)
{
2024-08-14 12:13:00 +00:00
var peerId = GetPeerId(@event.Payload.NodeIdentity);
var name = GetName(@event.Payload.NodeIdentity);
if (!seen.Contains(peerId))
2024-08-07 09:18:40 +00:00
{
2024-08-14 12:13:00 +00:00
seen.Add(peerId);
2024-08-07 09:18:40 +00:00
2024-08-14 12:13:00 +00:00
log.AddStringReplace(peerId, name);
log.AddStringReplace(CodexUtils.ToShortId(peerId), name);
2024-08-07 09:18:40 +00:00
}
}
public override void Finish()
{
}
}
}