public override BufferCell[,] GetBufferContents(Rectangle r)
 {
     if (this.externalRawUI == null)
     {
         this.ThrowNotInteractive();
     }
     return this.externalRawUI.GetBufferContents(r);
 }
Beispiel #2
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!");
     }
 }
Beispiel #3
0
        /// <summary>
        /// This API copies a given character, foreground color, and background color to a region of the screen buffer. In this case, this functionality is not
        /// needed so the method throws a <see cref="NotImplementedException"/> 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)
        {
            BufferCell[,] contents = new BufferCell[rectangle.Right - rectangle.Left, rectangle.Bottom - rectangle.Top];

            for (int i = 0; i < rectangle.Right - rectangle.Left; i++)
            {
                for (int j = 0; j < rectangle.Bottom - rectangle.Top; j++)
                {
                    contents[i, j] = fill;
                }
            }

            SetBufferContents(new Coordinates(rectangle.Left, rectangle.Top), contents);
        }
Beispiel #4
0
        public static void PushHostUI( this PSHostRawUserInterface host )
        {
            var buffer = new Rectangle( 0, 0, host.BufferSize.Width, host.BufferSize.Height );
            HostBufferImage = new HostBuffer
            {
                BufferSize = host.BufferSize,
                Buffer = host.GetBufferContents( buffer ),

                CursorSize = host.CursorSize,
                CursorPosition = host.CursorPosition,

                Background = host.BackgroundColor,
                Foreground = host.ForegroundColor,

                WindowPosition = host.WindowPosition,
                WindowSize = host.WindowSize,
                WindowTitle = host.WindowTitle
            };
        }
		public override BufferCell[,] GetBufferContents(Rectangle rectangle)
		{
			throw new NotSupportedException(Resources.PSHostRawUserInterfaceGetBufferContentsNotSupported);
		}
Beispiel #6
0
        public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
        {
            _control.CompleteBackgroundWorkItems();
            if (rectangle.Left == -1 && rectangle.Right == -1)
            {
                _control.ClearScreen();
            }
            else

                // TODO: REIMPLEMENT PSHostRawUserInterface.SetBufferContents(Rectangle rectangle, BufferCell fill)
                throw new NotImplementedException("The SetBufferContents method is not (yet) implemented!");
            //if (_control.Dispatcher.CheckAccess())
            // {
            //     _control.SetBufferContents(rectangle, fill);
            // }
            // else
            // {
            //    _control.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)delegate
            //     {
            //         _control.SetBufferContents(rectangle, fill);
            //     });
            // }
        }
Beispiel #7
0
 public override BufferCell[,] GetBufferContents(Rectangle rectangle)
 {
     // TODO: REIMPLEMENT PSHostRawUserInterface.GetBufferContents(Rectangle rectangle)
     // throw new NotImplementedException("The GetBufferContents method is not (yet) implemented!");
     _control.CompleteBackgroundWorkItems();
     if (_control.Dispatcher.CheckAccess())
     {
         return _control.GetBufferContents(rectangle);
     }
     return (BufferCell[,])_control.Dispatcher.Invoke(DispatcherPriority.Normal, (Func<BufferCell[,]>)(() => _control.GetBufferContents(rectangle)));
 }
 /// <summary>
 /// Scrolls the contents of the console buffer.
 /// </summary>
 /// <param name="source">The source rectangle to scroll.</param>
 /// <param name="destination">The destination coordinates by which to scroll.</param>
 /// <param name="clip">The rectangle inside which the scrolling will be clipped.</param>
 /// <param name="fill">The cell with which the buffer will be filled.</param>
 public override void ScrollBufferContents(
     Rectangle source, 
     Coordinates destination, 
     Rectangle clip, 
     BufferCell fill)
 {
     Logger.Write(
         LogLevel.Warning,
         "PSHostRawUserInterface.ScrollBufferContents was called");
 }
        /// <summary>
        /// Get the character at the cursor when the user types 'tab' in the middle of line.
        /// </summary>
        /// <param name="cursorPosition">the cursor position where 'tab' is hit</param>
        /// <returns></returns>
        private char GetCharacterUnderCursor(Coordinates cursorPosition)
        {
            Rectangle region = new Rectangle(0, cursorPosition.Y, RawUI.BufferSize.Width - 1, cursorPosition.Y);
            BufferCell[,] content = RawUI.GetBufferContents(region);

            for (int index = 0, column = 0; column <= cursorPosition.X; index++)
            {
                BufferCell cell = content[0, index];
                if (cell.BufferCellType == BufferCellType.Complete || cell.BufferCellType == BufferCellType.Leading)
                {
                    if (column == cursorPosition.X)
                    {
                        return cell.Character;
                    }

                    column += ConsoleControl.LengthInBufferCells(cell.Character);
                }
            }

            Dbg.Assert(false, "the character at the cursor should be retrieved, never gets to here");
            return '\0';
        }
        GetBufferContents(Rectangle r)
        {
            if (_externalRawUI == null)
            {
                ThrowNotInteractive();
            }

            return _externalRawUI.GetBufferContents(r);
        }
Beispiel #11
0
 /// <summary>
 /// This API crops a region of the screen buffer. In this case, this functionality is not needed so the method throws a
 /// <see cref="NotImplementedException"/> exception.
 /// </summary>
 /// <param name="source">The region of the screen to be scrolled.</param>
 /// <param name="destination">The region of the screen to receive the source region contents.</param>
 /// <param name="clip">The region of the screen to include in the operation.</param>
 /// <param name="fill">The character and attributes to be used to fill all cell.</param>
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
Beispiel #12
0
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
 }
 public override void ScrollBufferContents(System.Management.Automation.Host.Rectangle source, System.Management.Automation.Host.Coordinates destination, System.Management.Automation.Host.Rectangle clip, System.Management.Automation.Host.BufferCell fill)
 {
     // throw new NotImplementedException();
 }
 public override System.Management.Automation.Host.BufferCell[,] GetBufferContents(System.Management.Automation.Host.Rectangle rectangle)
 {
     // throw new NotImplementedException();
     return(null);
 }
		public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
		{
			this.OnMessageCreated(new MessageCreatedEventArgs(new ClearBufferMessage(), false));
		}
Beispiel #16
0
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
 }
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip,
                                           BufferCell fill)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Scroll buffer contents.
 /// </summary>
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     _serverMethodExecutor.ExecuteVoidMethod(RemoteHostMethodId.ScrollBufferContents, new object[] { source, destination, clip, fill });
 }
        SetBufferContents(Rectangle r, BufferCell fill)
        {
            if (_externalRawUI == null)
            {
                ThrowNotInteractive();
            }

            _externalRawUI.SetBufferContents(r, fill);
        }
 /// <summary>
 /// Set buffer contents.
 /// </summary>
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     _serverMethodExecutor.ExecuteVoidMethod(RemoteHostMethodId.SetBufferContents1, new object[] { rectangle, fill });
 }
        ScrollBufferContents
        (
            Rectangle source,
            Coordinates destination,
            Rectangle clip,
            BufferCell fill
        )
        {
            if (_externalRawUI == null)
            {
                ThrowNotInteractive();
            }

            _externalRawUI.ScrollBufferContents(source, destination, clip, fill);
        }
 /// <summary>
 /// Get buffer contents.
 /// </summary>
 public override BufferCell[,] GetBufferContents(Rectangle rectangle)
 {
     // This method had an implementation earlier. However, owing
     // to a potential security risk of a malicious server scrapping
     // the screen contents of a client, this is now removed
     throw RemoteHostExceptions.NewNotImplementedException(RemoteHostMethodId.GetBufferContents);
 }
        /// <summary>
        /// Gets the contents of the console buffer in a rectangular area.
        /// </summary>
        /// <param name="rectangle">The rectangle inside which buffer contents will be accessed.</param>
        /// <returns>A BufferCell array with the requested buffer contents.</returns>
        public override BufferCell[,] GetBufferContents(Rectangle rectangle)
        {
            Logger.Write(
                LogLevel.Warning,
                "PSHostRawUserInterface.GetBufferContents was called");

            throw new System.NotImplementedException();
        }
Beispiel #24
0
 public abstract BufferCell[,] GetBufferContents(Rectangle rectangle);
 /// <summary>
 /// Sets the contents of the buffer inside the specified rectangle.
 /// </summary>
 /// <param name="rectangle">The rectangle inside which buffer contents will be filled.</param>
 /// <param name="fill">The BufferCell which will be used to fill the requested space.</param>
 public override void SetBufferContents(
     Rectangle rectangle, 
     BufferCell fill)
 {
     Logger.Write(
         LogLevel.Warning,
         "PSHostRawUserInterface.SetBufferContents was called");
 }
Beispiel #26
0
 public abstract void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill);
Beispiel #27
0
        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);
            //    });
            //}
        }
Beispiel #28
0
 public abstract void SetBufferContents(Rectangle rectangle, BufferCell fill);
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// This functionality is not currently implemented. The call fails with an exception.
 /// </summary>
 /// <param name="rectangle">Unused</param>
 /// <returns>Returns nothing - call fails.</returns>
 public override BufferCell[,] GetBufferContents(Rectangle rectangle)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
		public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
		{
			throw new NotSupportedException(Resources.PSHostRawUserInterfaceScrollBufferContentsNotSupported);
		}
 /// <summary>
 /// This functionality is not currently implemented. The call fails with an exception.
 /// </summary>
 /// <param name="source">Unused</param>
 /// <param name="destination">Unused</param>
 /// <param name="clip">Unused</param>
 /// <param name="fill">Unused</param>
 public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
 public override BufferCell[,] GetBufferContents(Rectangle rectangle)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 ///  This functionality is not currently implemented. The call fails with an exception.
 /// </summary>
 /// <param name="rectangle">Unused</param>
 /// <param name="fill">Unused</param>
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     throw new NotImplementedException("The method or operation is not implemented.");
 }
 public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
 {
     this.Output.Clear();
 }
Beispiel #36
0
 /// <summary>
 /// This API returns a rectangular region of the screen buffer. In this case, this functionality is not needed so the method throws a
 /// <see cref="NotImplementedException"/> exception.
 /// </summary>
 /// <param name="rectangle">Defines the size of the rectangle.</param>
 /// <returns>Throws a <see cref="NotImplementedException"/> exception.</returns>
 public override BufferCell[,] GetBufferContents(Rectangle rectangle)
 {
     throw new NotImplementedException();
 }