コード例 #1
0
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     throw new NotImplementedException();
 }
コード例 #2
0
 ///
 public abstract void ScrollBufferContents(Place source, Point destination, Place clip, BufferCell fill);
コード例 #3
0
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     _outputDispatcher.Clear();
 }
コード例 #4
0
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     if (this.externalRawUI == null)
     {
         this.ThrowNotInteractive();
     }
     this.externalRawUI.ScrollBufferContents(source, destination, clip, fill);
 }
コード例 #5
0
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
コード例 #6
0
ファイル: RawUI.cs プロジェクト: radtek/WmBridge
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     _terminal.QueueInstruction(TerminalInstructionCode.FillBufferContents, new { rect = rectangle, fill });
 }
コード例 #7
0
 public abstract void ScrollBufferContents(
     Rectangle source,
     Coordinates destination,
     Rectangle clip,
     BufferCell fill);
コード例 #8
0
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     this._serverMethodExecutor.ExecuteVoidMethod(RemoteHostMethodId.SetBufferContents1, new object[] { rectangle, fill });
 }
コード例 #9
0
 public BufferCell[,] NewBufferCellArray(Size size, BufferCell contents)
 {
     using (PSHostRawUserInterface._tracer.TraceMethod())
         return(this.NewBufferCellArray(size.Width, size.Height, contents));
 }
コード例 #10
0
 public abstract void SetBufferContents(Rectangle rectangle, BufferCell fill);
コード例 #11
0
 public static void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
 }
コード例 #12
0
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     ConsoleHandler.ScrollBufferContents(source, destination, clip, fill);
 }
コード例 #13
0
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     ConsoleHandler.SetBufferContents(rectangle, fill);
 }
コード例 #14
0
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     Debug.Assert(false, "Not Implemented");
 }
コード例 #15
0
ファイル: HostRawUI.cs プロジェクト: tiksn/PoshConsole
        public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
        {
            // TODO: REIMPLEMENT PSHostRawUserInterface.ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
            throw new NotImplementedException("The ScrollBufferContents method is not (yet) implemented!");

            //if (_control.Dispatcher.CheckAccess())
            //{
            //    _control.ScrollBufferContents(source, destination, clip, fill);
            //}
            //else
            //{
            //   _control.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate
            //    {
            //        _control.ScrollBufferContents(source, destination, clip, fill);
            //    });
            //}
        }
コード例 #16
0
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     this._serverMethodExecutor.ExecuteVoidMethod(RemoteHostMethodId.ScrollBufferContents, new object[] { source, destination, clip, fill });
 }
コード例 #17
0
        public BufferCell[,] GetBufferContents(Rectangle rectangle)
        {
            BufferCell[,] bufferCells = new BufferCell[(rectangle.Top - rectangle.Bottom), (rectangle.Right - rectangle.Left)];
            try
            {
                var cur = (int)
                          ((Next.ElementEnd.GetCharacterRect(LogicalDirection.Backward).Bottom + ScrollViewer.ContentVerticalOffset)
                           / (double.IsNaN(Document.LineHeight) ? Document.FontSize : Document.LineHeight));
                int count;
                var nextContextPosition = Next.ElementEnd.GetNextContextPosition(LogicalDirection.Backward);
                var start = nextContextPosition?.GetLineStartPosition(rectangle.Bottom - cur, out count);
                if (start != null)
                {
                    // for each line
                    for (var ln = 0; ln <= rectangle.Top - rectangle.Bottom; ln++)
                    {
                        // Resharper is being stupid here, these can't actually be null:
                        Debug.Assert(start != null, "start != null");
                        var next = start.GetLineStartPosition(1);
                        start = start.GetPositionAtOffset(rectangle.Left);
                        // Resharper is being stupid here, these can't actually be null:
                        Debug.Assert(start != null, "start != null");
                        Debug.Assert(next != null, "next != null");
                        // if there's text on this line after that char, there's no output
                        if (start.GetOffsetToPosition(next) <= 0)
                        {
                            continue;
                        }

                        var end = start.GetPositionAtOffset(1);
                        Debug.Assert(end != null, "end != null");

                        // for each character in the line
                        int c = 0, width = rectangle.Right - rectangle.Left;
                        while (end.GetOffsetToPosition(next) <= 0 && c < width)
                        {
                            var range = new TextRange(start, end);
                            bufferCells[ln, c++] = new BufferCell(
                                range.Text[0],
                                range.GetBackgroundAsConsoleColor(),
                                range.GetForegroundAsConsoleColor(),
                                BufferCellType.Complete);

                            end = end.GetPositionAtOffset(1);
                        }

                        // for the whitespace ta the end of the line
                        for (; c < width; c++)
                        {
                            bufferCells[ln, c] = new BufferCell(' ', ForegroundColor, BackgroundColor, BufferCellType.Complete);
                        }
                        start = next;
                    }
                }
            }
            catch (Exception ex)
            {
                Write(ConsoleBrushes.ErrorForeground, ConsoleBrushes.ErrorBackground, ex.Message);
            }
            return(bufferCells);
        }
コード例 #18
0
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     Output.Clear();
 }
コード例 #19
0
        Show(PendingProgress pendingProgress)
        {
            Dbg.Assert(pendingProgress != null, "pendingProgress may not be null");

            _bufSize = _rawui.BufferSize;

            // In order to keep from slicing any CJK double-cell characters that might be present in the screen buffer,
            // we use the full width of the buffer.

            int maxWidth  = _bufSize.Width;
            int maxHeight = Math.Max(5, _rawui.WindowSize.Height / 3);

            _content = pendingProgress.Render(maxWidth, maxHeight, _rawui);
            if (_content == null)
            {
                // There's nothing to show.

                Hide();
                _progressRegion = null;
                return;
            }

            BufferCell[,] newRegion;
            if (ProgressNode.IsMinimalProgressRenderingEnabled())
            {
                // Legacy progress rendering relies on a BufferCell which defines a character, foreground color, and background color
                // per cell.  This model doesn't work with ANSI escape sequences.  However, there is existing logic on rendering that
                // relies on the existence of the BufferCell to know if something has been rendered previously.  Here we are creating
                // an empty BufferCell, but using the second dimension to capture the number of rows so that we can clear that many
                // elsewhere in Hide().
                newRegion = new BufferCell[0, _content.Length];
            }
            else
            {
                newRegion = _rawui.NewBufferCellArray(_content, _ui.ProgressForegroundColor, _ui.ProgressBackgroundColor);
            }

            Dbg.Assert(newRegion != null, "NewBufferCellArray has failed!");

            if (_progressRegion == null)
            {
                // we've never shown this pane before.

                _progressRegion = newRegion;
                Show();
            }
            else
            {
                // We have shown the pane before. We have to be smart about when we restore the saved region to minimize
                // flicker. We need to decide if the new contents will change the dimensions of the progress pane
                // currently being shown.  If it will, then restore the saved region, and show the new one.  Otherwise,
                // just blast the new one on top of the last one shown.

                // We're only checking size, not content, as we assume that the content will always change upon receipt
                // of a new ProgressRecord.  That's not guaranteed, of course, but it's a good bet.  So checking content
                // would usually result in detection of a change, so why bother?

                bool sizeChanged =
                    (newRegion.GetLength(0) != _progressRegion.GetLength(0)) ||
                    (newRegion.GetLength(1) != _progressRegion.GetLength(1));

                _progressRegion = newRegion;

                if (sizeChanged)
                {
                    if (IsShowing)
                    {
                        Hide();
                    }

                    Show();
                }
                else
                {
                    if (ProgressNode.IsMinimalProgressRenderingEnabled())
                    {
                        WriteContent();
                    }
                    else
                    {
                        _rawui.SetBufferContents(_location, _progressRegion);
                    }
                }
            }
        }
コード例 #20
0
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
 }
コード例 #21
0
        private static IEnumerable <object> StreamCaptureImpl(TrailingSpaceBehavior behavior,
                                                              BufferCell[,] cells,
                                                              ConsoleColor fg, ConsoleColor bg,
                                                              int width, int y,
                                                              bool populate)
        {
            List <Line>        lines     = populate ? new List <Line>(y) : null;
            Capturer           automaton = new Capturer(behavior, width, fg, bg);
            List <PendingSpan> pending   = automaton.pending;

            yield return(new ConsoleLog(fg, bg, width,
                                        populate ? lines.AsReadOnly() : EmptyLineList));

            for (int line = 0; line != y; ++line)
            {
                for (int column = 0; column != width; ++column)
                {
                    BufferCell target = cells[line, column];
                    char       ch     = target.Character;
                    if (target.BufferCellType == BufferCellType.Complete || ch != '\0')
                    {
                        automaton.AddCharacter(ch,
                                               target.ForegroundColor, target.BackgroundColor);
                    }
                    else
                    {
                        automaton.AddCJK();
                    }
                }
                automaton.CompleteCurrentSpan();
                Line ln;
                /* This should not happen, but just being safe. */
                if (pending.Count == 0)
                {
                    ln = new Line(fg, bg, EmptySpanList);
                    if (populate)
                    {
                        lines.Add(ln);
                    }
                    yield return(ln);

                    yield return(null);

                    continue;
                }
                ConsoleColor fgLine, bgLine;
                automaton.ResolveLineColors(out fgLine, out bgLine);
                automaton.RemoveTrailingSpace(bgLine);
                List <Span> spans = populate ? new List <Span>(pending.Count) : null;
                ln = new Line(fgLine, bgLine, populate ? spans.AsReadOnly() : EmptySpanList);
                if (populate)
                {
                    lines.Add(ln);
                }
                yield return(ln);

                foreach (PendingSpan sp in pending)
                {
                    if (sp.Trimmed.Length == 0)
                    {
                        sp.Foreground = fgLine;
                    }
                    Span span = sp.ToSpan();
                    if (populate)
                    {
                        spans.Add(span);
                    }
                    yield return(span);
                }
                yield return(null);

                pending.Clear();
            }
        }
コード例 #22
0
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
 }
コード例 #23
0
 /// <summary>
 /// This API Copies a given character, foreground color, and background
 /// color to a region of the screen buffer. In this example this
 /// functionality is not needed so the method throws a
 /// NotImplementException exception./// </summary>
 /// <param name="rectangle">Defines the area to be filled. </param>
 /// <param name="fill">Defines the fill character.</param>
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     throw new NotImplementedException(
               "The method or operation is not implemented.");
 }
コード例 #24
0
 /// <summary>
 /// Copies a given character to a rectangular region of the screen
 /// buffer. This method is not implemented. The call fails with an
 /// exception.
 /// </summary>
 /// <param name="rectangle">A Rectangle structure that defines the area to be filled.</param>
 /// <param name="fill">A BufferCell structure that defines the fill character.</param>
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     throw new NotImplementedException("The SetBufferContents() method is not implemented by MyRawUserInterface.");
 }
コード例 #25
0
 public void SetBufferContents(System.Management.Automation.Host.Rectangle rectangle, BufferCell fill)
 {
     if (rectangle.Left == -1 && rectangle.Right == -1)
     {
         Console.Clear();
     }
     else
     {
         throw new NotImplementedException("The SetBufferContents method is not (yet) implemented!");
     }
 }
コード例 #26
0
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     throw new NotImplementedException();
 }
コード例 #27
0
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     Debug.Assert(false, "Not Implemented");
 }
コード例 #28
0
 /// <summary>
 /// Crops a region of the screen buffer. This functionality is not
 /// implemented. The call fails with an exception.
 /// </summary>
 /// <param name="source">The parameter is not used.</param>
 /// <param name="destination">The parameter is not used.</param>
 /// <param name="clip">The parameter is not used.</param>
 /// <param name="fill">The parameter is not used.</param>
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     throw new NotImplementedException("The ScrollBufferContents() method is not implemented by MyRawUserInterface.");
 }
コード例 #29
0
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     throw new NotImplementedException("Not implemented because not needed");
 }