bool PacketLogHandler(GameClient client, Direction direction, RawPacket packet) { _writer.Write(new PacketLogEntry(DateTime.Now, client.Proxy.Info.Id, direction, client.Proxy.Processor.Serializer.GameMessages.NameToCode[packet.Name], packet.Payload)); return(true); }
public void Start() { var serializer = _context.Serializer; _writer = new PacketLogWriter(serializer.Region, serializer.GameMessages, serializer.SystemMessages, _context.Proxies.Select(x => x.Info).ToArray(), Configuration.LogDirectory, Configuration.LogFileNameFormat, Configuration.CompressLogs); _context.Dispatch.AddHandler((client, direction, code, packet, flags) => { _writer.Write(new PacketLogEntry(DateTime.Now, client.Proxy.Info.Id, direction, code, packet.Payload)); return(true); }, new PacketFilter(long.MinValue).WithSilenced(null)); _log.Basic("Packet logger plugin started"); }