~ruther/NosSmooth

025319a302fb35e1fa881897400a050249a7a65a — Rutherther 2 years ago 7cc28a4
feat(samples): update file client QoL
M Samples/FileClient/App.cs => Samples/FileClient/App.cs +2 -1
@@ 71,7 71,8 @@ public class App : BackgroundService
        if (!runResult.IsSuccess)
        {
            _logger.LogResultError(runResult);
            await _lifetime.StopAsync(default);
        }

        await _lifetime.StopAsync(default);
    }
}
\ No newline at end of file

M Samples/FileClient/Client.cs => Samples/FileClient/Client.cs +1 -1
@@ 62,7 62,7 @@ public class Client : BaseNostaleClient
        {
            stopRequested.ThrowIfCancellationRequested();
            var line = await reader.ReadLineAsync();
            if (line is null)
            if (string.IsNullOrEmpty(line))
            {
                continue;
            }

M Samples/FileClient/Program.cs => Samples/FileClient/Program.cs +1 -1
@@ 36,7 36,7 @@ public static class Program
    public static async Task Main(string[] args)
    {
        await using FileStream stream = File.OpenRead(string.Join(' ', args));
        await CreateHost(stream).StartAsync();
        await CreateHost(stream).RunAsync();
    }

    private static IHost CreateHost(Stream fileStream)

M Samples/FileClient/Responders/PacketNotFoundResponder.cs => Samples/FileClient/Responders/PacketNotFoundResponder.cs +2 -0
@@ 5,6 5,7 @@
//  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;


@@ 38,6 39,7 @@ public class PacketNotFoundResponder : IPacketResponder<UnresolvedPacket>, IPack
    public Task<Result> Respond(PacketEventArgs<ParsingFailedPacket> packetArgs, CancellationToken ct = default)
    {
        _logger.LogWarning($"Could not parse packet {packetArgs.PacketString}");
        _logger.LogResultError(packetArgs.Packet.SerializerResult);
        return Task.FromResult(Result.FromSuccess());
    }
}
\ No newline at end of file

Do not follow this link