From 1920d37488836d4dc47f0f94262d9e00180763a1 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 17 Feb 2023 23:02:54 -0600 Subject: [PATCH] feat: update reportVersions command to use ConsoleResponse feat: update gettypes to use ConsoleResponse --- PepperDashEssentials/ControlSystem.cs | 2 +- .../Factory/DeviceFactory.cs | 19 ++++++------------- .../Plugins/PluginLoader.cs | 5 +++-- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 736a250f..e40cce4e 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -80,7 +80,7 @@ namespace PepperDash.Essentials CrestronConsole.AddNewConsoleCommand(PluginLoader.ReportAssemblyVersions, "reportversions", "Reports the versions of the loaded assemblies", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(PepperDash.Essentials.Core.DeviceFactory.GetDeviceFactoryTypes, "gettypes", "Gets the device types that can be built. Accepts a filter string.", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(Core.DeviceFactory.GetDeviceFactoryTypes, "gettypes", "Gets the device types that can be built. Accepts a filter string.", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(BridgeHelper.PrintJoinMap, "getjoinmap", "map(s) for bridge or device on bridge [brKey [devKey]]", ConsoleAccessLevelEnum.AccessOperator); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index bad3e531..793ff34a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -172,21 +172,14 @@ namespace PepperDash.Essentials.Core /// /// Prints the type names and associated metadata from the FactoryMethods collection. /// - /// + /// public static void GetDeviceFactoryTypes(string filter) { - Dictionary types = new Dictionary(); + var types = !string.IsNullOrEmpty(filter) + ? FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value) + : FactoryMethods; - if (!string.IsNullOrEmpty(filter)) - { - types = FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value); - } - else - { - types = FactoryMethods; - } - - Debug.Console(0, "Device Types:"); + CrestronConsole.ConsoleCommandResponse("Device Types:"); foreach (var type in types.OrderBy(t => t.Key)) { @@ -198,7 +191,7 @@ namespace PepperDash.Essentials.Core cType = type.Value.CType.FullName; } - Debug.Console(0, + CrestronConsole.ConsoleCommandResponse( @"Type: '{0}' CType: '{1}' Description: {2}", type.Key, cType, description); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs index 9da843b8..f69d35d0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs @@ -194,10 +194,11 @@ namespace PepperDash.Essentials /// public static void ReportAssemblyVersions(string command) { - Debug.Console(0, "Loaded Assemblies:"); + + CrestronConsole.ConsoleCommandResponse("Loaded Assemblies:"); foreach (var assembly in LoadedAssemblies) { - Debug.Console(0, "{0} Version: {1}", assembly.Name, assembly.Version); + CrestronConsole.ConsoleCommandResponse("{0} Version: {1}", assembly.Name, assembly.Version); } }