private static void ProcessConsoleData(Push_Stdio_StdOut std) { if (std.WindowsX != LastBuffer.WindowsX || std.WindowsY != LastBuffer.WindowsY) { ConsoleUtilities.CONSOLE_SCREEN_BUFFER_INFO_EX ex = new ConsoleUtilities.CONSOLE_SCREEN_BUFFER_INFO_EX(); ex.cbSize = 96; res = ConsoleUtilities.GetConsoleScreenBufferInfoEx(StdOutHandle, ref ex); ex.dwMaximumWindowSize.X = ex.dwSize.X = (short)std.WindowsX; ex.dwMaximumWindowSize.Y = ex.dwSize.Y = (short)std.WindowsY; ex.srWindow.Top = ex.srWindow.Left = 0; ex.srWindow.Right = (short)std.WindowsX; ex.srWindow.Bottom = (short)std.WindowsY; res = ConsoleUtilities.SetConsoleScreenBufferInfoEx(StdOutHandle, ref ex); } if (std.CursorX != LastBuffer.CursorX || std.CursorY != LastBuffer.CursorY) { ConsoleUtilities.COORD c = new ConsoleUtilities.COORD(); c.X = (short)std.CursorX; c.Y = (short)std.CursorY; res = ConsoleUtilities.SetConsoleCursorPosition(StdOutHandle, c); } if (std.Data == null) { std.Data = new ConsoleUtilities.CHAR_INFO2[1]; } if (LastBuffer.Data == null) { LastBuffer.Data = new ConsoleUtilities.CHAR_INFO2[1]; } bool DataModified = false; if (std.Data.Length != LastBuffer.Data.Length) { DataModified = true; } if (DataModified == false) { for (int i = 0; i < std.Data.Length; i++) { if (LastBuffer.Data[i].b[0] != std.Data[i].b[0] || LastBuffer.Data[i].b[1] != std.Data[i].b[1] || LastBuffer.Data[i].b[2] != std.Data[i].b[2] || LastBuffer.Data[i].b[3] != std.Data[i].b[3]) { DataModified = true; break; } } } if (DataModified == true) { ConsoleUtilities.COORD c = new ConsoleUtilities.COORD(); c.X = (short)std.WindowsX; c.Y = (short)std.WindowsY; ConsoleUtilities.COORD p = new ConsoleUtilities.COORD(); p.X = p.Y = 0; ConsoleUtilities.SMALL_RECT r = new ConsoleUtilities.SMALL_RECT(); r.Left = r.Top = 0; r.Right = (short)std.WindowsX; r.Bottom = (short)std.WindowsY; res = ConsoleUtilities.WriteConsoleOutput(StdOutHandle, std.Data, c, p, ref r); } LastBuffer = std; }