예제 #1
0
 /// <summary>
 /// Writes character and attribute information to a rectangular portion of the screen buffer.
 /// </summary>
 /// <param name="bufferName">Name of the buffer to write from.</param>
 /// <param name="bufferX">Column position of the first character to be written from the array.</param>
 /// <param name="bufferY">Row position of the first character to be written from the array.</param>
 /// <param name="left">Column position of the top-left corner of the screen buffer area where characters are to be written.</param>
 /// <param name="top">Row position of the top-left corner of the screen buffer area where characters are to be written.</param>
 /// <param name="right">Column position of the bottom-right corner of the screen buffer area where characters are to be written.</param>
 /// <param name="bottom">Row position of the bottom-right corner of the screen buffer area where characters are to be written.</param>
 public static void WriteBuffer(string bufferName, int bufferX, int bufferY, int left, int top, int right, int bottom)
 {
     CheckBuffer(bufferName);
     var buffer = buffers[bufferName];
     var bufferSize = new CoordInternal (buffer.GetLength(1), buffer.GetLength(0));
     var bufferPos = new CoordInternal(bufferX, bufferY);
     var writeRegion = new RectInternal(left, top, right, bottom);
     WinCon.WriteConsoleOutput(ZOutput.hConsoleOutput, buffer, bufferSize, bufferPos, writeRegion);
 }
예제 #2
0
        /// <summary>
        /// Reads a rectangular block of character and attribute information from the screen buffer into the passed array.
        /// </summary>
        /// <param name="bufferName">Name of the buffer to read to.</param>
        /// <param name="bufferX">The column position in the array where the first character is to be placed.</param>
        /// <param name="bufferY">The row position in the array where the first character is to be placed.</param>
        /// <param name="left">Column position of the top-left corner of the screen buffer area from which characters are to be read.</param>
        /// <param name="top">Row position of the top-left corner of the screen buffer area from which characters are to be read.</param>
        /// <param name="right">Column position of the bottom-right corner of the screen buffer area from which characters are to be read.</param>
        /// <param name="bottom">Row position of the bottom-right corner of the screen buffer area from which characters are to be read.</param>
        public static void ReadBuffer(string bufferName, int bufferX, int bufferY, int left, int top, int right, int bottom)
        {
            var buffer = new ZCharInfo[bottom-top+1,right-left+1];
            var bufferSize = new CoordInternal(buffer.GetLength(1), buffer.GetLength(0));
            var bufferPos  = new CoordInternal(bufferX, bufferY);
            var readRegion = new RectInternal(left, top, right, bottom);
            WinCon.ReadConsoleOutput(ZOutput.hConsoleOutput, buffer, bufferSize, bufferPos, readRegion);

            if (buffers.ContainsKey(bufferName))
            {
                buffers[bufferName] = buffer;
            }
            else
            {
                buffers.Add(bufferName, buffer);
            }
        }