aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ShiftOS.WinForms/Applications/Terminal.cs4
-rw-r--r--ShiftOS.WinForms/Controls/TerminalBox.cs16
-rw-r--r--ShiftOS_TheReturn/ServerManager.cs11
-rw-r--r--ShiftOS_TheReturn/TerminalBackend.cs34
4 files changed, 59 insertions, 6 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);
diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs
index 7da09f1..4d599cd 100644
--- a/ShiftOS_TheReturn/ServerManager.cs
+++ b/ShiftOS_TheReturn/ServerManager.cs
@@ -132,6 +132,7 @@ namespace ShiftOS.Engine
{
Console.WriteLine(acc);
}
+ TerminalBackend.PrintPrompt();
}
else if(msg.Name == "update_your_cp")
{
@@ -154,11 +155,15 @@ namespace ShiftOS.Engine
{
var ex = JsonConvert.DeserializeObject<Exception>(msg.Contents);
TerminalBackend.PrefixEnabled = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.Red;
+ ConsoleEx.Bold = true;
+ Console.Write($@"{{MUD_ERROR}}: ");
+ ConsoleEx.Bold = false;
+ ConsoleEx.Italic = true;
ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow;
- Console.WriteLine($@"{{MUD_ERROR}}: {ex.Message}");
- ConsoleEx.ForegroundColor = ConsoleColor.White;
+ Console.WriteLine(ex.Message);
TerminalBackend.PrefixEnabled = true;
- Console.Write($"{SaveSystem.CurrentSave.Username}@{CurrentSave.SystemName}:~$ ");
+ TerminalBackend.PrintPrompt();
}
else
{
diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs
index f78d7a5..841fd6a 100644
--- a/ShiftOS_TheReturn/TerminalBackend.cs
+++ b/ShiftOS_TheReturn/TerminalBackend.cs
@@ -283,7 +283,39 @@ namespace ShiftOS.Engine
}
return false;
}
-
+
+ public static void PrintPrompt()
+ {
+ ConsoleEx.Italic = false;
+ ConsoleEx.Underline = false;
+
+ ConsoleEx.ForegroundColor = ConsoleColor.Magenta;
+ ConsoleEx.Bold = true;
+ Console.Write(SaveSystem.CurrentSave.Username);
+ ConsoleEx.Bold = false;
+ ConsoleEx.ForegroundColor = ConsoleColor.Gray;
+ Console.Write("@");
+ ConsoleEx.Italic = true;
+ ConsoleEx.Bold = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.Yellow;
+ Console.Write(SaveSystem.CurrentSave.SystemName);
+ ConsoleEx.Italic = false;
+ ConsoleEx.Bold = false;
+ ConsoleEx.ForegroundColor = ConsoleColor.Gray;
+ Console.Write(":~");
+ Console.ForegroundColor = ConsoleColor.White;
+ ConsoleEx.Italic = true;
+ if (KernelWatchdog.InKernelMode == true)
+ Console.Write("#");
+ else
+ Console.Write("$");
+ ConsoleEx.Italic = false;
+ ConsoleEx.Bold = false;
+ ConsoleEx.ForegroundColor = ConsoleColor.White;
+ Console.Write(" ");
+ }
+
+
static TerminalBackend()
{
ServerMessageReceived onMessageReceived = (msg) =>