~ruther/NosSmooth.Comms

ref: e79a2839b9c316659d9a7b607bd33d8e0beccee8 NosSmooth.Comms/src/Local/NosSmooth.Comms.Inject/MessageResponders/ConsoleResponder.cs -rw-r--r-- 768 bytes
e79a2839 — Rutherther feat: update to new split raw and managed client 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//
//  ConsoleResponder.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 NosSmooth.Comms.Data.Responders;
using NosSmooth.Comms.Inject.Messages;
using Remora.Results;

namespace NosSmooth.Comms.Inject.MessageResponders;

/// <inheritdoc />
public class ConsoleResponder : IMessageResponder<ConsoleMessage>
{
    /// <inheritdoc />
    public Task<Result> Respond(ConsoleMessage message, CancellationToken ct = default)
    {
        if (message.Open)
        {
            WinConsole.Initialize(false);
        }
        else
        {
            WinConsole.Close();
        }

        return Task.FromResult(Result.FromSuccess());
    }
}
Do not follow this link