From deba3e4e55c58fb18771b3558a64a62b67dbdb5a Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sat, 4 Feb 2023 20:34:54 +0100 Subject: [PATCH] feat(sample): add support for handshake response errorful results --- src/Samples/ConsolePacketLogger/ClientService.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Samples/ConsolePacketLogger/ClientService.cs b/src/Samples/ConsolePacketLogger/ClientService.cs index 53211e1..8f54bbf 100644 --- a/src/Samples/ConsolePacketLogger/ClientService.cs +++ b/src/Samples/ConsolePacketLogger/ClientService.cs @@ -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"})" -- 2.48.1