Esempio n. 1
0
            private void CommitLine()
            {
                if (_lineBuffer.IsEmpty)
                {
                    return;
                }

                var linePoints = _lineBuffer.GetPoints();

                _lineBuffer.Clear();

                if (linePoints == null)
                {
                    return;
                }

                for (var i = 0; i < linePoints.Length; i++)
                {
                    linePoints[i].X += _zero.X;
                    linePoints[i].Y += _zero.Y;
                }
                _drawLine(linePoints);
            }
Esempio n. 2
0
 public void PushLines(List <string> lines)
 {
     LineBuffer.Clear();
     LineBuffer.AddRange(lines);
 }
        /// <summary>
        ///     Implements IDebugOutputCallbacks2::Output2
        /// </summary>
        public int Output2(DEBUG_OUTCB Which, DEBUG_OUTCBF Flags, UInt64 Arg, string Text)
        {
            var mask = (DEBUG_OUTPUT)Arg;

            if (Which == DEBUG_OUTCB.EXPLICIT_FLUSH)
            {
                //Flush();
                return(S_OK);
            }
            if (string.IsNullOrEmpty(Text))
            {
                return(S_OK);
            }
            bool textIsDml = (Which == DEBUG_OUTCB.DML);

            if (OutputActive)
            {
                lock (this)
                {
                    OutputActive       = false;
                    PreviousTextWasDml = textIsDml;
                    PreviousDmlFlags   = Flags;
                    DbgStringBuilder LineBuffer;
                    LineBuffers.TryGetValue(mask, out LineBuffer);
                    int LineInputPos = 0;
                    LineInputPositions.TryGetValue(mask, out LineInputPos);
                    bool waitForClosingDML = false;

                    if (LineBuffer == null)
                    {
                        LineBuffer        = new DbgStringBuilder(ExecutionUtilities, 1024);
                        LineBuffers[mask] = LineBuffer;
                    }
                    for (int i = 0; i < Text.Length; ++i)
                    {
                        char c = Text[i];
                        if (c == '<')
                        {
                            waitForClosingDML = true;
                        }
                        if (waitForClosingDML)
                        {
                            if (c == '>')
                            {
                                waitForClosingDML = false;
                            }
                        }
                        if (c == '\n' && waitForClosingDML == false)
                        {
                            LineBuffer.AppendLine();
                            ProcessLine(mask, LineBuffer.ToString(), textIsDml, Flags);
                            LineBuffer.Clear();
                            LineInputPos = 0;
                        }
                        else if (c == '\r')
                        {
                            LineInputPos = 0;
                        }
                        else
                        {
                            if (LineInputPos >= LineBuffer.Length)
                            {
                                LineBuffer.Append(c);
                            }
                            else
                            {
                                LineBuffer[LineInputPos] = c;
                            }
                            ++LineInputPos;
                        }
                    }

                    LineInputPositions[mask] = LineInputPos;

                    OutputActive = true;
                }
            }

            return(S_OK);
        }