~ruther/NosSmooth.Comms

ref: edcd26a2f21092371c9169ae56ae85c144a8bfd7 NosSmooth.Comms/src/Samples/ConsolePacketLogger/EveryPacketResponder.cs -rw-r--r-- 749 bytes
edcd26a2 — Rutherther feat: move to new injection supporting passing in data and returning integer 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//
//  EveryPacketResponder.cs
//
//  Copyright (c) František Boháček. All rights reserved.
//  Licensed under the MIT license. See LICENSE file in the project root for full license information.

using NosSmooth.Core.Packets;
using NosSmooth.Packets;
using NosSmooth.PacketSerializer.Abstractions.Attributes;
using Remora.Results;

namespace ConsolePacketLogger;

/// <inheritdoc />
public class EveryPacketResponder : IRawPacketResponder
{
    /// <inheritdoc />
    public Task<Result> Respond(PacketEventArgs packetArgs, CancellationToken ct = default)
    {
        Console.WriteLine((packetArgs.Source == PacketSource.Server ? "[Recv]\t" : "[Sent]\t") + packetArgs.PacketString);
        return Task.FromResult(Result.FromSuccess());
    }
}
Do not follow this link