~ruther/NosSmooth.Comms

deba3e4e55c58fb18771b3558a64a62b67dbdb5a — Rutherther 2 years ago 15287bf
feat(sample): add support for handshake response errorful results
1 files changed, 13 insertions(+), 0 deletions(-)

M src/Samples/ConsolePacketLogger/ClientService.cs
M src/Samples/ConsolePacketLogger/ClientService.cs => src/Samples/ConsolePacketLogger/ClientService.cs +13 -0
@@ 61,6 61,7 @@ public class ClientService : BackgroundService
        }

        var process = Process.GetProcessById(_options.ProcessId);
        _injector.OpenConsole(process);
        var connectionResult = await _injector.EstablishNamedPipesConnectionAsync
            (process, stoppingToken, stoppingToken);
        if (!connectionResult.IsDefined(out var connection))


@@ 81,6 82,18 @@ public class ClientService : BackgroundService
            return;
        }

        if (!handshakeResponse.ClientRunning)
        {
            _logger.LogError("The client is not running?");
        }

        if (handshakeResponse.InitializationErrorfulResult is not null
            && !handshakeResponse.InitializationErrorfulResult.Value.IsSuccess)
        {
            _logger.LogError("Received an error from the Inject assembly that failed on initialization.");
            _logger.LogResultError(handshakeResponse.InitializationErrorfulResult);
        }

        _logger.LogInformation
        (
            $"Connected to {handshakeResponse.CharacterName ?? "Not in game"} ({handshakeResponse.CharacterId?.ToString() ?? "Not in game"})"

Do not follow this link