From bb3897160b4e30ad6feaf56cd4381675ba6b0d05 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 1 Apr 2020 15:57:51 -0600 Subject: [PATCH] Adds a method to print the typenames to console --- PepperDashEssentials/ControlSystem.cs | 4 ++- .../Factory/DeviceFactory.cs | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 46ac77f2..f4046c85 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -47,7 +47,9 @@ namespace PepperDash.Essentials ConsoleAccessLevelEnum.AccessOperator); } - CrestronConsole.AddNewConsoleCommand(PluginLoader.ReportAssemblyVersions, "reportversions", "Reports the versions of the loaded assemblies", ConsoleAccessLevelEnum.AccessOperator); + 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(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index 5b5af20b..0fab13ae 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -86,6 +86,31 @@ namespace PepperDash.Essentials.Core return null; } + + /// + /// Prints the type names fromt the FactoryMethods collection. + /// + /// + public static void GetDeviceFactoryTypes(string filter) + { + List typeNames = new List(); + + if (!string.IsNullOrEmpty(filter)) + { + typeNames = FactoryMethods.Keys.Where(k => k.Contains(filter)).ToList(); + } + else + { + typeNames = FactoryMethods.Keys.ToList(); + } + + Debug.Console(0, "Device Types:"); + + foreach (var type in typeNames) + { + Debug.Console(0, "type: '{0}'", type); + } + } }