private IEnumerable <byte> CommandHandler(IEnumerable <byte> received) { SafeExecution.TryCatch(() => CommandHandlerInternal(received), exception => _recorder.DefaultException(this, exception)); return(Enumerable.Empty <byte>()); }
private void RecordReceivedHandler(string value) { if (Activated) { SafeExecution.TryCatch(() => TrySendText(value), exception => _recorder.DefaultException(this, exception)); } }
private void ConnectedHandler(string address) { SafeExecution.TryCatch(() => { _remoteTraceMonitorСonsistent.SetPrompt(address); _remoteTraceMonitorСonsistent.ClearTextBox(); }, exception => _recorder.DefaultException(this, exception)); }
private async Task OpenInternal() { _isOpened = true; _recorder.RecordInfo(nameof(NetworkPoint), $"NetworkPoint opened {(_sListener.LocalEndPoint).Address}:{(_sListener.LocalEndPoint).Port}"); while (_isOpened) { _sListener.Listen(10); ISocket socket = await _sListener.AcceptAsync(); SafeExecution.TryCatch(() => ConnectionAcceptedHandler(socket), ExceptionHandler); } }
private bool TryConnectInternal(INetworkAddress networkAddress, out INetworkTunnel networkTunnel) { var socket = _socketFactory.Invoke(networkAddress.IP.AddressFamily, SocketType.Stream, ProtocolType.Tcp); var isFail = false; networkTunnel = default; SafeExecution.TryCatch( () => socket.Connect(networkAddress.IP, networkAddress.Port), e => { SafeExecution.TryCatch(() => socket.Dispose(), e => ExceptionHandler(e)); isFail = true; }); if (!isFail) { networkTunnel = _networkTunnelFactory.Invoke(socket); } return(!isFail); }
private void ReceivedHandler(byte[] receivedBytes) { SafeExecution.TryCatch(() => ReceivedHandlerInternal(receivedBytes), ExceptionHandler); }
public void Send(IEnumerable <byte> data) { SafeExecution.TryCatch(() => SendInternal(data), ExceptionHandler); }
public void Response(IEnumerable <byte> data) { SafeExecution.TryCatch(() => ResponseInternal(data), ExceptionHandler); }
public void ActivateAndSendCache() { SafeExecution.TryCatch(() => ActivateAndSendCacheInternal(), exception => _recorder.DefaultException(this, exception)); }
public void Start() { SafeExecution.TryCatch(() => _autoLocalConnector.Start(), exception => _recorder.DefaultException(this, exception)); }
public void RegisterCommand(string name, Action handler, string description = "") { SafeExecution.TryCatch(() => _remoteApiMap.RegisterCommand(name, handler, description), exception => _recorder.DefaultException(this, exception)); }
public void Send(byte[] data) { RecordSendInfo($"Tunnel.Send {data.Length}"); SafeExecution.TryCatch(() => _socket.Send(data), ExceptionHandler); }
private void Bind(IPAddress ipAddress, int port) { SafeExecution.TryCatch(() => _sListener.Bind(ipAddress, port), ExceptionHandler); }
private void AcceptedHandler(INetworkTunnel tunnel) { SafeExecution.TryCatch(() => AcceptedHandlerInternal(tunnel), ExceptionHandler); }
public void RegisterCommandWithParameters(string name, Action <IEnumerable <string> > handler, string description = "") { SafeExecution.TryCatch(() => _remoteApiMap.RegisterCommandWithParameters(name, handler, description), exception => _recorder.DefaultException(this, exception)); }
private void TextReceivedHandler(string value) { SafeExecution.TryCatch(() => _remoteTraceMonitorСonsistent.DisplayNextMessage(value), exception => _recorder.DefaultException(this, exception)); }
public void RegisterWrongCommandHandler(Action action) { SafeExecution.TryCatch(() => _remoteApiMap.RegisterWrongCommandHandler(action), exception => _recorder.DefaultException(this, exception)); }