diff options
| author | Michael <[email protected]> | 2017-01-08 09:57:10 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-01-08 09:57:10 -0500 |
| commit | f30dcf5ef41d54c588d7b42c48be8d941abba72e (patch) | |
| tree | 7705f99b965673b1c034ac2b1c56e65072c827df /ShiftOS_TheReturn/TerminalTextWriter.cs | |
| parent | 69dfad54724d4176dfce238a8d7e73970e6eef24 (diff) | |
| download | shiftos_thereturn-f30dcf5ef41d54c588d7b42c48be8d941abba72e.tar.gz shiftos_thereturn-f30dcf5ef41d54c588d7b42c48be8d941abba72e.tar.bz2 shiftos_thereturn-f30dcf5ef41d54c588d7b42c48be8d941abba72e.zip | |
Initial upload
Diffstat (limited to 'ShiftOS_TheReturn/TerminalTextWriter.cs')
| -rw-r--r-- | ShiftOS_TheReturn/TerminalTextWriter.cs | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/ShiftOS_TheReturn/TerminalTextWriter.cs b/ShiftOS_TheReturn/TerminalTextWriter.cs new file mode 100644 index 0000000..b36c13a --- /dev/null +++ b/ShiftOS_TheReturn/TerminalTextWriter.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.IO; +using System.Windows.Forms; + +namespace ShiftOS.Engine +{ + public class TerminalTextWriter : TextWriter + { + [System.Runtime.InteropServices.DllImport("user32.dll")] + public static extern bool LockWindowUpdate(IntPtr hWndLock); + + + public override Encoding Encoding + { + get + { + return Encoding.Unicode; + } + } + + public ITerminalWidget UnderlyingControl + { + get + { + return AppearanceManager.ConsoleOut; + } + } + + public void select() + { + Desktop.InvokeOnWorkerThread(new Action(() => + { + UnderlyingControl.SelectBottom(); + + })); + } + + public override void Write(char value) + { + Desktop.InvokeOnWorkerThread(new Action(() => + { + UnderlyingControl.Write(value.ToString()); + select(); + })); + } + + public override void WriteLine(string value) + { + Desktop.InvokeOnWorkerThread(new Action(() => + { + UnderlyingControl.WriteLine(value); + select(); + })); + } + + public void SetLastText() + { + } + + public override void Write(string value) + { + Desktop.InvokeOnWorkerThread(new Action(() => + { + UnderlyingControl.Write(value.ToString()); + select(); + })); + } + + + } +} |
