~ruther/NosSmooth.Comms

b06241f4c3251cb4b2ddfb0bf29d5936f5906637 — František Boháček 2 years ago ae864d5
feat: remove Character id and name from HandshakeResponse

For easier handling. To add custom options, NosBindingManager has to be
loaded when options are received, that is when RunClientRequest is
received. HandshakeResponder needed NosBindingManager as well,
that was causing loading options early.
M src/Core/NosSmooth.Comms.Abstractions/Messages/HandshakeRequest.cs => src/Core/NosSmooth.Comms.Abstractions/Messages/HandshakeRequest.cs +7 -0
@@ 6,4 6,11 @@

namespace NosSmooth.Comms.Data.Messages;

/// <summary>
/// A handshake, signaling use of MessagePack protocol and
/// registering what events to return.
/// </summary>
/// <param name="Identification">Identification of the client, does not have to be unique for clients.</param>
/// <param name="SendRawPackets">Whether to send raw serialized packets using <see cref="RawPacketMessage"/>.</param>
/// <param name="SendDeserializedPackets">Whether to send deserialized packets using <see cref="PacketMessage"/>.</param>
public record HandshakeRequest(string Identification, bool SendRawPackets, bool SendDeserializedPackets);
\ No newline at end of file

M src/Core/NosSmooth.Comms.Abstractions/Messages/HandshakeResponse.cs => src/Core/NosSmooth.Comms.Abstractions/Messages/HandshakeResponse.cs +9 -3
@@ 8,10 8,16 @@ using Remora.Results;

namespace NosSmooth.Comms.Data.Messages;

/// <summary>
/// A response to <see cref="HandshakeRequest"/>.
/// </summary>
/// <param name="ClientRunning">Whether the client is currently running. Will be false in case of an error or if the client has not been started yet.</param>
/// <param name="InitializationResult">The result obtained from client initialization.</param>
/// <param name="CharacterId">The id of current character, if any.</param>
/// <param name="CharacterName">The name of current character, if any.</param>
public record HandshakeResponse
(
    bool ClientRunning,
    Result? InitializationErrorfulResult,
    long? CharacterId,
    string? CharacterName
    Result? InitializationResult,
    Result? BindingManagerResult
);
\ No newline at end of file

Do not follow this link