aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-09 16:46:34 -0500
committerMichael <[email protected]>2017-03-09 16:46:34 -0500
commit251521835b60024dec292a759d738e2b81bf1417 (patch)
treeeb9a943b9a365e51bc25843168c6a301e2316783 /ShiftOS.WinForms
parent3f08cb807c1490af423450e3eb03a46aa11caf2f (diff)
downloadshiftos_thereturn-251521835b60024dec292a759d738e2b81bf1417.tar.gz
shiftos_thereturn-251521835b60024dec292a759d738e2b81bf1417.tar.bz2
shiftos_thereturn-251521835b60024dec292a759d738e2b81bf1417.zip
Console colors!
Diffstat (limited to 'ShiftOS.WinForms')
-rw-r--r--ShiftOS.WinForms/Applications/Terminal.cs4
-rw-r--r--ShiftOS.WinForms/Controls/TerminalBox.cs16
2 files changed, 18 insertions, 2 deletions
diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs
index 7bab213..65a8f0f 100644
--- a/ShiftOS.WinForms/Applications/Terminal.cs
+++ b/ShiftOS.WinForms/Applications/Terminal.cs
@@ -134,7 +134,7 @@ namespace ShiftOS.WinForms.Applications
rtbterm.Text = "";
TerminalBackend.PrefixEnabled = true;
TerminalBackend.InStory = false;
- Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
+ TerminalBackend.PrintPrompt();
if (Shiftorium.UpgradeInstalled("wm_free_placement"))
{
this.ParentForm.Width = 640;
@@ -276,7 +276,7 @@ namespace ShiftOS.WinForms.Applications
}
if (TerminalBackend.PrefixEnabled)
{
- Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
+ TerminalBackend.PrintPrompt();
}
}
}
diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs
index 7c0da57..9e4c61c 100644
--- a/ShiftOS.WinForms/Controls/TerminalBox.cs
+++ b/ShiftOS.WinForms/Controls/TerminalBox.cs
@@ -24,6 +24,7 @@
using System;
using System.Collections.Generic;
+using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
@@ -56,16 +57,31 @@ namespace ShiftOS.WinForms.Controls
{
this.HideSelection = true;
this.Select(this.TextLength, 0);
+ this.SelectionFont = ConstructFont();
this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor);
this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor);
this.AppendText(Localization.Parse(text));
this.HideSelection = false;
}
+ private Font ConstructFont()
+ {
+ FontStyle fs = FontStyle.Regular;
+ if (ConsoleEx.Bold)
+ fs = fs | FontStyle.Bold;
+ if (ConsoleEx.Italic)
+ fs = fs | FontStyle.Italic;
+ if (ConsoleEx.Underline)
+ fs = fs | FontStyle.Underline;
+
+ return new Font(this.Font, fs);
+ }
+
public void WriteLine(string text)
{
this.HideSelection = true;
this.Select(this.TextLength, 0);
+ this.SelectionFont = ConstructFont();
this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor);
this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor);
this.AppendText(Localization.Parse(text) + Environment.NewLine);