aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/AppLauncherDaemon.cs20
-rw-r--r--ShiftOS_TheReturn/Commands.cs52
-rw-r--r--ShiftOS_TheReturn/ConsoleEx.cs28
-rw-r--r--ShiftOS_TheReturn/Infobox.cs6
-rw-r--r--ShiftOS_TheReturn/KernelWatchdog.cs64
-rw-r--r--ShiftOS_TheReturn/Scripting.cs53
-rw-r--r--ShiftOS_TheReturn/ServerManager.cs13
-rw-r--r--ShiftOS_TheReturn/ShiftOS.Engine.csproj1
-rw-r--r--ShiftOS_TheReturn/Skinning.cs4
-rw-r--r--ShiftOS_TheReturn/TerminalBackend.cs278
10 files changed, 394 insertions, 125 deletions
diff --git a/ShiftOS_TheReturn/AppLauncherDaemon.cs b/ShiftOS_TheReturn/AppLauncherDaemon.cs
index 7ef34c1..5e3bd72 100644
--- a/ShiftOS_TheReturn/AppLauncherDaemon.cs
+++ b/ShiftOS_TheReturn/AppLauncherDaemon.cs
@@ -66,12 +66,24 @@ namespace ShiftOS.Engine
{
foreach (var attr in type.GetCustomAttributes(false))
{
- if (attr is LauncherAttribute)
+ bool isAllowed = true;
+ if(attr is MultiplayerOnlyAttribute)
{
- var launch = attr as LauncherAttribute;
- if (launch.UpgradeInstalled)
+ if(KernelWatchdog.MudConnected == false)
{
- win.Add(new LauncherItem { DisplayData = launch, LaunchType = type });
+ isAllowed = false;
+
+ }
+ }
+ if (isAllowed == true)
+ {
+ if (attr is LauncherAttribute)
+ {
+ var launch = attr as LauncherAttribute;
+ if (launch.UpgradeInstalled)
+ {
+ win.Add(new LauncherItem { DisplayData = launch, LaunchType = type });
+ }
}
}
}
diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs
index 779c616..73a7e2d 100644
--- a/ShiftOS_TheReturn/Commands.cs
+++ b/ShiftOS_TheReturn/Commands.cs
@@ -133,6 +133,7 @@ namespace ShiftOS.Engine
[Namespace("mud")]
public static class MUDCommands
{
+ [MultiplayerOnly]
[Command("status")]
public static bool Status()
{
@@ -155,6 +156,8 @@ namespace ShiftOS.Engine
{
Console.WriteLine("{ERROR}: " + ex.Message);
}
+
+ TerminalBackend.PrefixEnabled = false;
return true;
}
catch (Exception ex)
@@ -174,6 +177,7 @@ namespace ShiftOS.Engine
return true;
}
+ [MultiplayerOnly]
[Command("disconnect")]
[RequiresUpgrade("hacker101_deadaccts")]
public static bool Disconnect()
@@ -183,6 +187,7 @@ namespace ShiftOS.Engine
return true;
}
+ [MultiplayerOnly]
[Command("sendmsg")]
[KernelMode]
[RequiresUpgrade("hacker101_deadaccts")]
@@ -195,48 +200,6 @@ namespace ShiftOS.Engine
}
}
- [RequiresUpgrade("mud_fundamentals")]
- [Namespace("chat")]
- public static class ChatCommands
- {
- [RequiresArgument("id")]
- [RequiresArgument("name")]
- [RequiresArgument("topic")]
- [Command("create")]
- public static bool CreateChat(Dictionary<string, object> args)
- {
- string id = "";
- string topic = "";
- string name = "";
- int max_users = 0;
-
- id = args["id"] as string;
- name = args["topic"] as string;
- topic = args["name"] as string;
-
- bool valid = true;
-
- if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(topic))
- valid = false;
-
- if (valid)
- {
- ServerManager.SendMessage("chat_create", $@"{{
- id: ""{id}"",
- name: ""{name}"",
- topic: ""{topic}"",
- max_users: {max_users}
-}}");
- }
- else
- {
- Console.WriteLine("{CHAT_PLEASE_PROVIDE_VALID_CHANNEL_DATA}");
- }
- return true;
- }
-
- }
-
[TutorialLock]
[Namespace("trm")]
public static class TerminalCommands
@@ -266,6 +229,7 @@ namespace ShiftOS.Engine
}
}
+ [MultiplayerOnly]
[Namespace("dev")]
public static class ShiftOSDevCommands
{
@@ -475,6 +439,7 @@ namespace ShiftOS.Engine
return true;
}
+ [MultiplayerOnly]
[Command("save")]
public static bool Save()
{
@@ -482,6 +447,7 @@ namespace ShiftOS.Engine
return true;
}
+ [MultiplayerOnly]
[Command("status")]
public static bool Status()
{
@@ -494,7 +460,7 @@ Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed,
}
}
-
+ [MultiplayerOnly]
[Namespace("shiftorium")]
public static class ShiftoriumCommands
{
diff --git a/ShiftOS_TheReturn/ConsoleEx.cs b/ShiftOS_TheReturn/ConsoleEx.cs
new file mode 100644
index 0000000..69f6a18
--- /dev/null
+++ b/ShiftOS_TheReturn/ConsoleEx.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShiftOS.Engine
+{
+ public static class ConsoleEx
+ {
+ static ConsoleEx()
+ {
+ ForegroundColor = ConsoleColor.White;
+ BackgroundColor = ConsoleColor.Black;
+
+ Bold = false;
+ Italic = false;
+ Underline = false;
+ }
+
+ public static ConsoleColor ForegroundColor { get; set; }
+ public static ConsoleColor BackgroundColor { get; set; }
+
+ public static bool Bold { get; set; }
+ public static bool Italic { get; set; }
+ public static bool Underline { get; set; }
+ }
+}
diff --git a/ShiftOS_TheReturn/Infobox.cs b/ShiftOS_TheReturn/Infobox.cs
index 3e8fa30..e3308dc 100644
--- a/ShiftOS_TheReturn/Infobox.cs
+++ b/ShiftOS_TheReturn/Infobox.cs
@@ -55,11 +55,11 @@ namespace ShiftOS.Engine
/// </summary>
/// <param name="title">Infobox title</param>
/// <param name="message">Infobox message</param>
- public static void Show(string title, string message)
+ public static void Show(string title, string message, Action callback = null)
{
title = Localization.Parse(title);
message = Localization.Parse(message);
- _infobox.Open(title, message);
+ _infobox.Open(title, message, callback);
}
public static void PromptText(string title, string message, Action<string> callback)
@@ -89,7 +89,7 @@ namespace ShiftOS.Engine
// Infobox Interface
public interface IInfobox
{
- void Open(string title, string msg);
+ void Open(string title, string msg, Action callback = null);
void PromptText(string title, string message, Action<string> callback);
void PromptYesNo(string title, string message, Action<bool> callback);
}
diff --git a/ShiftOS_TheReturn/KernelWatchdog.cs b/ShiftOS_TheReturn/KernelWatchdog.cs
index 1b59b25..cc03f5a 100644
--- a/ShiftOS_TheReturn/KernelWatchdog.cs
+++ b/ShiftOS_TheReturn/KernelWatchdog.cs
@@ -25,8 +25,44 @@ namespace ShiftOS.Engine
}
}
+ private static bool _mudConnected = true;
+
public static bool InKernelMode { get; private set; }
- public static bool MudConnected { get; set; }
+ public static bool MudConnected
+ {
+ get
+ {
+ return _mudConnected;
+ }
+ set
+ {
+ if(value == false)
+ {
+ foreach(var win in AppearanceManager.OpenForms)
+ {
+ foreach(var attr in win.ParentWindow.GetType().GetCustomAttributes(true))
+ {
+ if(attr is MultiplayerOnlyAttribute)
+ {
+ ConsoleEx.Bold = true;
+ ConsoleEx.Underline = false;
+ ConsoleEx.Italic = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.Red;
+ Console.Write("Error:");
+ ConsoleEx.Bold = false;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow;
+ Console.WriteLine("Cannot disconnect from multi-user domain because an app that depends on it is open.");
+ TerminalBackend.PrintPrompt();
+ return;
+ }
+ }
+ }
+ }
+
+ _mudConnected = value;
+ Desktop.PopulateAppLauncher();
+ }
+ }
public static bool IsSafe(Type type)
{
@@ -66,5 +102,31 @@ namespace ShiftOS.Engine
InKernelMode = false;
Console.WriteLine("<kernel> Kernel mode disabled.");
}
+
+ internal static bool CanRunOffline(Type method)
+ {
+ if (MudConnected)
+ return true;
+
+ foreach (var attr in method.GetCustomAttributes(false))
+ {
+ if (attr is MultiplayerOnlyAttribute)
+ return false;
+ }
+ return true;
+ }
+
+ internal static bool CanRunOffline(MethodInfo method)
+ {
+ if (MudConnected)
+ return true;
+
+ foreach(var attr in method.GetCustomAttributes(false))
+ {
+ if (attr is MultiplayerOnlyAttribute)
+ return false;
+ }
+ return true;
+ }
}
}
diff --git a/ShiftOS_TheReturn/Scripting.cs b/ShiftOS_TheReturn/Scripting.cs
index 3ecf9d9..d96bc98 100644
--- a/ShiftOS_TheReturn/Scripting.cs
+++ b/ShiftOS_TheReturn/Scripting.cs
@@ -63,6 +63,26 @@ namespace ShiftOS.Engine.Scripting
public dynamic Lua = new DynamicLua.DynamicLua();
public bool Running = true;
+ static LuaInterpreter()
+ {
+ ServerManager.MessageReceived += (msg) =>
+ {
+ if (msg.Name == "run")
+ {
+ TerminalBackend.PrefixEnabled = false;
+ var cntnts = JsonConvert.DeserializeObject<dynamic>(msg.Contents);
+ var interp = new LuaInterpreter();
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ interp.Execute(cntnts.script.ToString());
+
+ });
+ TerminalBackend.PrefixEnabled = true;
+ TerminalBackend.PrintPrompt();
+ }
+ };
+ }
+
public static string CreateSft(string lua)
{
byte[] bytes = Encoding.UTF8.GetBytes(lua);
@@ -341,12 +361,41 @@ end");
}
}
+ [Exposed("mud")]
+ public class MUDFunctions
+ {
+ public void sendDiagnostic(string src, string cat, object val)
+ {
+ ServerManager.SendMessage("diag_log", $"[{src}] <{cat}>: {val}");
+ }
+ }
+
+ [Exposed("userinfo")]
+ public class UserInfoFunctions
+ {
+ public string getUsername()
+ {
+ return SaveSystem.CurrentSave.Username;
+ }
+
+ public string getSysname()
+ {
+ return SaveSystem.CurrentSave.SystemName;
+ }
+
+ public string getEmail()
+ {
+ return getUsername() + "@" + getSysname();
+ }
+ }
+
+
[Exposed("infobox")]
public class InfoboxFunctions
{
- public void show(string title, string message)
+ public void show(string title, string message, Action callback = null)
{
- Infobox.Show(title, message);
+ Infobox.Show(title, message, callback);
}
public void question(string title, string message, Action<bool> callback)
diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs
index a121ab6..31b3129 100644
--- a/ShiftOS_TheReturn/ServerManager.cs
+++ b/ShiftOS_TheReturn/ServerManager.cs
@@ -125,6 +125,8 @@ namespace ShiftOS.Engine
{
thisGuid = new Guid(msg.Contents);
GUIDReceived?.Invoke(msg.Contents);
+ TerminalBackend.PrefixEnabled = true;
+ TerminalBackend.PrintPrompt();
}
else if(msg.Name == "allusers")
{
@@ -132,6 +134,7 @@ namespace ShiftOS.Engine
{
Console.WriteLine(acc);
}
+ TerminalBackend.PrintPrompt();
}
else if(msg.Name == "update_your_cp")
{
@@ -154,9 +157,15 @@ namespace ShiftOS.Engine
{
var ex = JsonConvert.DeserializeObject<Exception>(msg.Contents);
TerminalBackend.PrefixEnabled = true;
- Console.WriteLine($@"{{MUD_ERROR}}: {ex.Message}");
+ ConsoleEx.ForegroundColor = ConsoleColor.Red;
+ ConsoleEx.Bold = true;
+ Console.Write($@"{{MUD_ERROR}}: ");
+ ConsoleEx.Bold = false;
+ ConsoleEx.Italic = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow;
+ Console.WriteLine(ex.Message);
TerminalBackend.PrefixEnabled = true;
- Console.Write($"{SaveSystem.CurrentSave.Username}@{CurrentSave.SystemName}:~$ ");
+ TerminalBackend.PrintPrompt();
}
else
{
diff --git a/ShiftOS_TheReturn/ShiftOS.Engine.csproj b/ShiftOS_TheReturn/ShiftOS.Engine.csproj
index 5521f49..b6ff903 100644
--- a/ShiftOS_TheReturn/ShiftOS.Engine.csproj
+++ b/ShiftOS_TheReturn/ShiftOS.Engine.csproj
@@ -100,6 +100,7 @@
<Compile Include="CommandParser.cs" />
<Compile Include="Commands.cs" />
<Compile Include="Command.cs" />
+ <Compile Include="ConsoleEx.cs" />
<Compile Include="CrashHandler.cs" />
<Compile Include="CrashHandler.Designer.cs">
<DependentUpon>CrashHandler.cs</DependentUpon>
diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs
index 43e0b5d..800b107 100644
--- a/ShiftOS_TheReturn/Skinning.cs
+++ b/ShiftOS_TheReturn/Skinning.cs
@@ -865,12 +865,12 @@ namespace ShiftOS.Engine {
[ShifterMeta("System")]
[ShifterCategory("General")]
[ShifterName("Terminal text color")]
- public Color TerminalForeColor = DefaultForeground;
+ public ConsoleColor TerminalForeColorCC = ConsoleColor.White;
[ShifterMeta("System")]
[ShifterCategory("General")]
[ShifterName("Terminal background color")]
- public Color TerminalBackColor = DesktopBG;
+ public ConsoleColor TerminalBackColorCC = ConsoleColor.Black;
[ShifterMeta("Desktop")]
[ShifterCategory("Desktop Panel")]
diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs
index fd2524f..318c818 100644
--- a/ShiftOS_TheReturn/TerminalBackend.cs
+++ b/ShiftOS_TheReturn/TerminalBackend.cs
@@ -149,97 +149,170 @@ namespace ShiftOS.Engine {
return RunClient(ns + "." + cmd, args, isRemote);
}
- public static bool RunClient(string text, Dictionary<string, string> args, bool isRemote = false) {
+
+ public static bool RunClient(string text, Dictionary<string, string> argss, bool isRemote = false) {
+ Dictionary<string, object> args = new Dictionary<string, object>();
+ foreach (KeyValuePair<string, string> arg in argss) {
+ args[arg.Key] = arg.Value;
+ }
+ return RunClient(text, args, isRemote);
+ }
+
+ public static bool RunClient(string text, Dictionary<string, object> args, bool isRemote = false) {
latestCommmand = text;
+ //Console.WriteLine(text + " " + "{" + string.Join(",", args.Select(kv => kv.Key + "=" + kv.Value).ToArray()) + "}" + " " + isRemote);
+
foreach (var asmExec in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) {
try {
var asm = Assembly.LoadFile(asmExec);
var types = asm.GetTypes();
-
- foreach (var type in types) {
- if (Shiftorium.UpgradeAttributesUnlocked(type)) {
- if (KernelWatchdog.IsSafe(type)) {
- foreach (var a in type.GetCustomAttributes(false)) {
- if (a is Namespace) {
- var ns = a as Namespace;
- if (text.Split('.')[0] == ns.name) {
- foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) {
- if (Shiftorium.UpgradeAttributesUnlocked(method)) {
- if (KernelWatchdog.IsSafe(method)) {
- if (CanRunRemotely(method, isRemote)) {
- foreach (var ma in method.GetCustomAttributes(false)) {
- if (ma is Command) {
+ foreach (var type in types)
+ {
+ if (Shiftorium.UpgradeAttributesUnlocked(type))
+ {
+ foreach (var a in type.GetCustomAttributes(false))
+ {
+ if (a is Namespace)
+ {
+ var ns = a as Namespace;
+ if (text.Split('.')[0] == ns.name)
+ {
+ if (KernelWatchdog.IsSafe(type))
+ {
+ if (KernelWatchdog.CanRunOffline(type))
+ {
+ foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static))
+ {
+ if (Shiftorium.UpgradeAttributesUnlocked(method))
+ {
+ if (CanRunRemotely(method, isRemote))
+ {
+ foreach (var ma in method.GetCustomAttributes(false))
+ {
+ if (ma is Command)
+ {
var cmd = ma as Command;
- if (text.Split('.')[1] == cmd.name) {
-
- var attr = method.GetCustomAttribute<CommandObsolete>();
-
- if (attr != null) {
- string newcommand = attr.newcommand;
- if (attr.warn) {
- Console.WriteLine(Localization.Parse((newcommand == "" ? "{ERROR}" : "{WARN}") + attr.reason, new Dictionary<string, string>() {
+ if (text.Split('.')[1] == cmd.name)
+ {
+ if (KernelWatchdog.IsSafe(method))
+ {
+ if (KernelWatchdog.CanRunOffline(method))
+ {
+ var attr = method.GetCustomAttribute<CommandObsolete>();
+
+ if (attr != null)
+ {
+ string newcommand = attr.newcommand;
+ if (attr.warn)
+ {
+ Console.WriteLine(Localization.Parse((newcommand == "" ? "{ERROR}" : "{WARN}") + attr.reason, new Dictionary<string, string>() {
{"%newcommand", newcommand}
}));
- }
- if (newcommand != "") {
- // redo the entire process running newcommand
-
- return RunClient(newcommand, args);
- }
- }
+ }
+ if (newcommand != "")
+ {
+ // redo the entire process running newcommand
- var requiresArgs = method.GetCustomAttributes<RequiresArgument>();
-
- bool error = false;
- bool providedusage = false;
-
- foreach (RequiresArgument argument in requiresArgs) {
- if (!args.ContainsKey(argument.argument)) {
+ return RunClient(newcommand, args);
+ }
+ }
- if (!providedusage) {
- string usageparse = "{COMMAND_" + ns.name.ToUpper() + "_" + cmd.name.ToUpper() + "_USAGE}";
- if (usageparse == Localization.Parse(usageparse))
- usageparse = "";
- else
- usageparse = Shiftorium.UpgradeInstalled("help_usage") ? Localization.Parse("{ERROR}{USAGE}" + usageparse, new Dictionary<string, string>() {
+ var requiresArgs = method.GetCustomAttributes<RequiresArgument>();
+ bool error = false;
+ bool providedusage = false;
+
+ foreach (RequiresArgument argument in requiresArgs)
+ {
+ if (!args.ContainsKey(argument.argument))
+ {
+
+ if (!providedusage)
+ {
+ string usageparse = "{COMMAND_" + ns.name.ToUpper() + "_" + cmd.name.ToUpper() + "_USAGE}";
+ if (usageparse == Localization.Parse(usageparse))
+ usageparse = "";
+ else
+ usageparse = Shiftorium.UpgradeInstalled("help_usage") ? Localization.Parse("{ERROR}{USAGE}" + usageparse, new Dictionary<string, string>() {
{"%ns", ns.name},
{"%cmd", cmd.name}
}) : "";
- Console.WriteLine(usageparse);
+ Console.WriteLine(usageparse);
- providedusage = true;
- }
-
- if (Shiftorium.UpgradeInstalled("help_usage")) {
- Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED}", new Dictionary<string, string>() {
+ providedusage = true;
+ }
+ if (Shiftorium.UpgradeInstalled("help_usage"))
+ {
+ Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED}", new Dictionary<string, string>() {
{"%argument", argument.argument}
}));
- } else {
- Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED_NO_USAGE}"));
+ }
+ else
+ {
+ Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED_NO_USAGE}"));
+ }
+
+ error = true;
+ }
+ }
+
+ if (error)
+ {
+ throw new Exception("{ERROR_COMMAND_WRONG}");
}
- error = true;
+ try
+ {
+ return (bool)method.Invoke(null, new[] { args });
+ }
+ catch (TargetInvocationException e)
+ {
+ Console.WriteLine(Localization.Parse("{ERROR_EXCEPTION_THROWN_IN_METHOD}"));
+ Console.WriteLine(e.InnerException.Message);
+ Console.WriteLine(e.InnerException.StackTrace);
+ return true;
+ }
+ catch
+ {
+ return (bool)method.Invoke(null, new object[] { });
+ }
}
- }
+ else
+ {
+ Console.Write("<");
+ ConsoleEx.Bold = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkRed;
+ Console.Write("session_mgr");
+ ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC;
+ ConsoleEx.Bold = false;
+ Console.Write(">");
+ ConsoleEx.Italic = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow;
+ Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain..");
+ return true;
- if (error) {
- throw new Exception("{ERROR_COMMAND_WRONG}");
+ }
}
-
- try {
- return (bool)method.Invoke(null, new[] { args });
- } catch (TargetInvocationException e) {
- Console.WriteLine(Localization.Parse("{ERROR_EXCEPTION_THROWN_IN_METHOD}"));
- Console.WriteLine(e.InnerException.Message);
- Console.WriteLine(e.InnerException.StackTrace);
+ else
+ {
+ Console.Write("<");
+ ConsoleEx.Bold = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkRed;
+ Console.Write("watchdog");
+ ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC;
+ ConsoleEx.Bold = false;
+ Console.Write(">");
+ ConsoleEx.Italic = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow;
+ Console.WriteLine(" You cannot run this command.");
+ KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir.");
return true;
- } catch {
- return (bool)method.Invoke(null, new object[] { });
}
}
+
+
}
}
} else {
@@ -250,21 +323,90 @@ namespace ShiftOS.Engine {
}
}
+ else
+ {
+ Console.Write("<");
+ ConsoleEx.Bold = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkRed;
+ Console.Write("session_mgr");
+ ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC;
+ ConsoleEx.Bold = false;
+ Console.Write(">");
+ ConsoleEx.Italic = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow;
+ Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain..");
+ return true;
+
+ }
+ }
+ else
+ {
+
+ Console.Write("<");
+ ConsoleEx.Bold = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkRed;
+ Console.Write("watchdog");
+ ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC;
+ ConsoleEx.Bold = false;
+ Console.Write(">");
+ ConsoleEx.Italic = true;
+ ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow;
+ Console.WriteLine(" You cannot run this command.");
+ KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir.");
+ return true;
}
}
}
}
-
}
}
} catch { }
}
return false;
}
+ public static void PrintPrompt()
+ {
+ if (SaveSystem.CurrentSave != null)
+ {
+ ConsoleEx.BackgroundColor = SkinEngine.LoadedSkin.TerminalBackColorCC;
+ 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 = SkinEngine.LoadedSkin.TerminalForeColorCC;
+ Console.Write(" ");
+ }
+ }
+
- static TerminalBackend() {
- ServerMessageReceived onMessageReceived = (msg) => {
- if (msg.Name == "trm_invokecommand") {
+ static TerminalBackend()
+ {
+ ServerMessageReceived onMessageReceived = (msg) =>
+ {
+ if (msg.Name == "trm_invokecommand")
+ {
string text3 = "";
string text4 = msg.Contents;