Adds a method to print the typenames to console

This commit is contained in:
Neil Dorin
2020-04-01 15:57:51 -06:00
parent 3b2ff5eed8
commit bb3897160b
2 changed files with 28 additions and 1 deletions

View File

@@ -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 =>

View File

@@ -86,6 +86,31 @@ namespace PepperDash.Essentials.Core
return null;
}
/// <summary>
/// Prints the type names fromt the FactoryMethods collection.
/// </summary>
/// <param name="command"></param>
public static void GetDeviceFactoryTypes(string filter)
{
List<string> typeNames = new List<string>();
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);
}
}
}