Ejemplo n.º 1
0
        protected virtual void OnDataReceived(BashDataReceivedEventArgs e)
        {
            _logStringBuilder.Append($"{e.TimeReceived:u} : {e.BashData}");

            EventHandler<BashDataReceivedEventArgs> handler = DataReceived;
            handler?.Invoke(this, e);
        }
Ejemplo n.º 2
0
 private void _serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
 {
     SerialPort serialPort = sender as SerialPort;
     var serialData = serialPort?.ReadExisting();
     _commandOutputStringBuilder.Append(serialData);
     BashDataReceivedEventArgs args = new BashDataReceivedEventArgs
     {
         BashData = serialData,
         TimeReceived = DateTime.Now
     };
     OnDataReceived(args);
 }
Ejemplo n.º 3
0
        private void PollTcpStream()
        {
            while (PollLog)
            {
                var tcpData = ReadTcpStream();

                if (!string.IsNullOrEmpty(tcpData))
                {
                    _commandOutputStringBuilder.Append(tcpData);
                    BashDataReceivedEventArgs args = new BashDataReceivedEventArgs
                    {
                        BashData = tcpData,
                        TimeReceived = DateTime.Now
                    };
                    OnDataReceived(args);
                    Thread.Sleep(100);
                }
            }
        }