/
EvilBeaver
/
OneScript
Обзор
Документация
Войти
/
EvilBeaver
/
OneScript
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
v1.6.0
src/OneScript.DebugServices/TcpEventCallbackChannel.cs
42 строки
1 KB
Andrei Ovsiankin
Рефакторинг отладчика под один канал.
26 апр 2020, 20:32
26 апр 2020, 20:32
f5ddcac
Код
Авторство
О чём код?
/*---------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ using System; using System.Net.Sockets; using OneScript.DebugProtocol; using OneScript.DebugProtocol.Abstractions; using OneScript.DebugProtocol.TcpServer; namespace OneScript.DebugServices { public class TcpEventCallbackChannel : IDebugEventListener, IDisposable { private readonly ICommunicationChannel _channel; public TcpEventCallbackChannel(ICommunicationChannel channel) { _channel = channel; } public void ThreadStopped(int threadId, ThreadStopReason reason) { var dto = RpcCall.Create(nameof(IDebugEventListener), nameof(ThreadStopped), threadId, reason); _channel.Write(dto); } public void ProcessExited(int exitCode) { var dto = RpcCall.Create(nameof(IDebugEventListener), nameof(ProcessExited), exitCode); _channel.Write(dto); } public void Dispose() { _channel?.Dispose(); } } }