コード例 #1
0
ファイル: LLParser.cs プロジェクト: ProjectAgri20/newrepo
        protected virtual void OnDataReceived(BashDataReceivedEventArgs e)
        {
            _logStringBuilder.Append($"{e.TimeReceived:u} : {e.BashData}");

            EventHandler<BashDataReceivedEventArgs> handler = DataReceived;
            handler?.Invoke(this, e);
        }
コード例 #2
0
ファイル: LLParser.cs プロジェクト: ProjectAgri20/newrepo
 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);
 }
コード例 #3
0
ファイル: LLParser.cs プロジェクト: ProjectAgri20/newrepo
        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);
                }
            }
        }