Пример #1
0
        } /* ReportData */

        public void  ReportData(char ch)
        {
            if ((ch == '\n') || (ch == '\r'))
            {
                if (((ch == '\n') && (lastEolCh == '\r')) ||
                    ((ch == '\r') && (lastEolCh == '\n'))
                    )
                {
                    // We have a sequence of 'cr','lf'  or  'lf','cr'  we can ignore this
                    // character because the prev char would have forced a 'eol'
                    lastEolCh = '\0';
                }
                else
                {
                    // We are at the end of the text line,  we can now try parsing it.
                    manager.LogTxtLine(deviceId, curLine);
                    try
                    {
                        ParseTxtLine(curLine);
                    }
                    catch (Exception e4)
                    {
                        manager.LogTxtLine(deviceId, "Exception occurred during call to 'ParseTxtLine'." + "\n\n" + e4.ToString());
                    }
                    curLine   = "";
                    lastEolCh = ch;
                }
            }
            else
            {
                // Add character to end of current line
                curLine += ch;
                //if  (curLine.Length > 200)
                if (curLine.Length > 150)
                {
                    // We are not getting any '\r' or '\n' characters from this
                    // instrument.  The specialized device is going to have to
                    // deal with it.
                    try
                    {
                        ParseTxtBlock(ref curLine);
                    }
                    catch (Exception e3)
                    {
                        manager.LogTxtLine(deviceId, "Exception occurred during call to 'ParseTxtBlock'." + "\n\n" + e3.ToString());
                        curLine = "";
                    }
                    lastEolCh = ch;
                }
            }
        } /* ReportData */