From 336d22977232d2e6db891250fd113086adf3c0d1 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Fri, 30 Jun 2017 15:21:33 -0400 Subject: [PATCH] Moved console registration validation into IcdConsole --- ICD.Common.Utils/Utils/IcdConsole.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ICD.Common.Utils/Utils/IcdConsole.cs b/ICD.Common.Utils/Utils/IcdConsole.cs index a577798..e66d24f 100644 --- a/ICD.Common.Utils/Utils/IcdConsole.cs +++ b/ICD.Common.Utils/Utils/IcdConsole.cs @@ -96,11 +96,19 @@ namespace ICD.Common.Utils #endif } - public static void AddNewConsoleCommand(Action callback, string command, string help, eAccessLevel accessLevel) + public static bool AddNewConsoleCommand(Action callback, string command, string help, eAccessLevel accessLevel) { #if SIMPLSHARP + // Avoid crashing Simpl applications + if (IcdEnvironment.RuntimeEnvironment == IcdEnvironment.eRuntimeEnvironment.SimplSharp) + return false; + + if (CrestronConsole.ConsoleRegistered) + return false; + CrestronConsole.AddNewConsoleCommand(str => callback(str), command, help, (ConsoleAccessLevelEnum)(int)accessLevel); #endif + return true; } } } \ No newline at end of file