示例#1
0
        internal static void SetConsoleCursorPosition(SafeFileHandle handle, dotCmd.Native.ConsoleHostNativeMethods.COORD cursorPosition)
        {
            bool result = ConsoleHostNativeMethods.SetConsoleCursorPosition(handle.DangerousGetHandle(), cursorPosition);

            if (result == false)
            {
                int err = Marshal.GetLastWin32Error();
                throw CreateException("Cannot set the curor position", err);
            }
        }
示例#2
0
        internal static dotCmd.Native.ConsoleHostNativeMethods.CHAR_INFO[] ReadConsoleOutput(
            SafeFileHandle handle,
            dotCmd.Native.ConsoleHostNativeMethods.CHAR_INFO[] buffer,
            dotCmd.Native.ConsoleHostNativeMethods.COORD bufferSize,
            dotCmd.Native.ConsoleHostNativeMethods.COORD bufferCoord,
            ref dotCmd.Native.ConsoleHostNativeMethods.SMALL_RECT readRegion)
        {
            bool result = ConsoleHostNativeMethods.ReadConsoleOutput(handle.DangerousGetHandle(), buffer, bufferSize, bufferCoord, ref readRegion);

            if (result == false)
            {
                int err = Marshal.GetLastWin32Error();
                throw CreateException("Cannot read from the output buffer", err);
            }

            return(buffer);
        }