aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/TerminalTextWriter.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-05-28 07:21:16 -0400
committerMichael <[email protected]>2017-05-28 07:21:16 -0400
commit8e3bdf71e71096711f11a0d51b2b384e117391ee (patch)
tree4df860d8c7f48837a101491ce0d756a66720ff2a /ShiftOS_TheReturn/TerminalTextWriter.cs
parentdc0b8c66885593f7412e24bf7132bc08f6c40a9c (diff)
downloadshiftos_thereturn-8e3bdf71e71096711f11a0d51b2b384e117391ee.tar.gz
shiftos_thereturn-8e3bdf71e71096711f11a0d51b2b384e117391ee.tar.bz2
shiftos_thereturn-8e3bdf71e71096711f11a0d51b2b384e117391ee.zip
strip things down but make things better
Diffstat (limited to 'ShiftOS_TheReturn/TerminalTextWriter.cs')
-rw-r--r--ShiftOS_TheReturn/TerminalTextWriter.cs45
1 files changed, 26 insertions, 19 deletions
diff --git a/ShiftOS_TheReturn/TerminalTextWriter.cs b/ShiftOS_TheReturn/TerminalTextWriter.cs
index 010e02c..4c0c3a0 100644
--- a/ShiftOS_TheReturn/TerminalTextWriter.cs
+++ b/ShiftOS_TheReturn/TerminalTextWriter.cs
@@ -37,14 +37,19 @@ namespace ShiftOS.Engine
/// </summary>
public class TerminalTextWriter : TextWriter
{
- /// <summary>
- /// Win32 API call to lock the window from being updated.
- /// </summary>
- /// <param name="hWndLock">The Win32 window handle</param>
- /// <returns>...I....have no idea.</returns>
- [System.Runtime.InteropServices.DllImport("user32.dll")]
- public static extern bool LockWindowUpdate(IntPtr hWndLock);
+ public TerminalTextWriter()
+ {
+ ConsoleEx.OnFlush = () =>
+ {
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ UnderlyingControl?.Write(buffer);
+ buffer = "";
+ });
+ };
+ }
+
/// <summary>
/// Gets the encoding format for this <see cref="TextWriter"/>. God bless the Unicode Consortiem.
/// </summary>
@@ -94,11 +99,17 @@ namespace ShiftOS.Engine
}
else
{
- Desktop.InvokeOnWorkerThread(new Action(() =>
- {
- UnderlyingControl?.Write(value.ToString());
- select();
- }));
+ buffer += value;
+ }
+ }
+
+ private string buffer = "";
+
+ public string Buffer
+ {
+ get
+ {
+ return buffer;
}
}
@@ -118,11 +129,8 @@ namespace ShiftOS.Engine
else
{
- Desktop.InvokeOnWorkerThread(new Action(() =>
- {
- UnderlyingControl?.WriteLine(value);
- select();
- }));
+ buffer += value + Environment.NewLine;
+ ConsoleEx.Flush();
}
}
@@ -149,8 +157,7 @@ namespace ShiftOS.Engine
Desktop.InvokeOnWorkerThread(new Action(() =>
{
- UnderlyingControl?.Write(value.ToString());
- select();
+ buffer += value;
}));
}
}