// // PacketNotFoundResponder.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 Microsoft.Extensions.Logging; using NosSmooth.Core.Extensions; using NosSmooth.Core.Packets; using NosSmooth.Packets; using Remora.Results; namespace FileClient.Responders; /// /// Responds to packets that were not found. /// public class PacketNotFoundResponder : IPacketResponder, IPacketResponder { private readonly ILogger _logger; /// /// Initializes a new instance of the class. /// /// The logger. public PacketNotFoundResponder(ILogger logger) { _logger = logger; } /// public Task Respond(PacketEventArgs packetArgs, CancellationToken ct = default) { _logger.LogWarning($"Could not find packet {packetArgs.PacketString}"); return Task.FromResult(Result.FromSuccess()); } /// public Task Respond(PacketEventArgs packetArgs, CancellationToken ct = default) { _logger.LogWarning($"Could not parse packet {packetArgs.PacketString}"); _logger.LogResultError(packetArgs.Packet.SerializerResult); return Task.FromResult(Result.FromSuccess()); } }