Esempio n. 1
0
        private void ReaderThread()
        {
            using StreamReader read = new StreamReader(pipeIn);
            string?data;

            while ((data = read.ReadLine()) != null)
            {
                DataIn?.Invoke(this, new PipeReadEventArgs(data));
            }
        }
Esempio n. 2
0
        private void ReadLoop()
        {
            Boolean Aborted = false;

            while (!Aborted)
            {
                try
                {
                    System.Threading.Thread.Sleep(50);

                    Receive(SystemSocket);
                    if (receiveDone.WaitOne(SocketTimeoutMS))
                    {
                        byte         Data;
                        Queue <byte> NewData = new Queue <byte>();

                        while (InBuffer.TryDequeue(out Data))
                        {
                            NewData.Enqueue(Data);
                        }

                        if (NewData.Count > 0)
                        {
                            DataIn?.Invoke(this, NewData);
                        }
                    }
                }
                catch (ThreadAbortException)
                {
                    Aborted = true;
                }
                catch
                {
                    // Continue
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Platform-specific subclasses can call this to trigger the DataIn event
 /// </summary>
 /// <param name="DataBytes">Data received</param>
 protected void TriggerDataIn(Queue <byte> DataBytes)
 {
     DataIn?.Invoke(this, DataBytes);
 }