aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn/KernelWatchdog.cs
diff options
context:
space:
mode:
authorpfg <[email protected]>2017-03-12 09:45:11 -0700
committerpfg <[email protected]>2017-03-12 09:45:11 -0700
commit5ee6043b9ea5baef45c08b5fb92fdebadd610dc0 (patch)
tree947cffe3f4693f9559cc7aaf5a2f3500e23f2b53 /ShiftOS_TheReturn/KernelWatchdog.cs
parent6460ccee378e15408768337dcdc1bc77da07da53 (diff)
parent11da99a43bb3225ebd5fc82cb4765309804f8eba (diff)
downloadshiftos_thereturn-5ee6043b9ea5baef45c08b5fb92fdebadd610dc0.tar.gz
shiftos_thereturn-5ee6043b9ea5baef45c08b5fb92fdebadd610dc0.tar.bz2
shiftos_thereturn-5ee6043b9ea5baef45c08b5fb92fdebadd610dc0.zip
Command theming complete
Diffstat (limited to 'ShiftOS_TheReturn/KernelWatchdog.cs')
-rw-r--r--ShiftOS_TheReturn/KernelWatchdog.cs64
1 files changed, 63 insertions, 1 deletions
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;
+ }
}
}