mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 10:38:16 +00:00
feat: refactor portal info command to improve configuration handling and response messages
This commit is contained in:
parent
c050bb4eb3
commit
404728c708
1 changed files with 25 additions and 13 deletions
|
|
@ -130,14 +130,8 @@ namespace PepperDash.Essentials
|
||||||
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented).Replace(Environment.NewLine, "\r\n"));
|
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented).Replace(Environment.NewLine, "\r\n"));
|
||||||
}, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator);
|
}, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
CrestronConsole.AddNewConsoleCommand(s =>
|
CrestronConsole.AddNewConsoleCommand(
|
||||||
CrestronConsole.ConsoleCommandResponse(
|
PrintPortalInfo,
|
||||||
"This system can be found at the following URLs:{2}" +
|
|
||||||
"System URL: {0}{2}" +
|
|
||||||
"Template URL: {1}{2}",
|
|
||||||
ConfigReader.ConfigObject.SystemUrl,
|
|
||||||
ConfigReader.ConfigObject.TemplateUrl,
|
|
||||||
CrestronEnvironment.NewLine),
|
|
||||||
"portalinfo",
|
"portalinfo",
|
||||||
"Shows portal URLS from configuration",
|
"Shows portal URLS from configuration",
|
||||||
ConsoleAccessLevelEnum.AccessOperator);
|
ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
@ -160,6 +154,29 @@ namespace PepperDash.Essentials
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PrintPortalInfo(string args)
|
||||||
|
{
|
||||||
|
if(ConfigReader.ConfigObject == null)
|
||||||
|
{
|
||||||
|
CrestronConsole.ConsoleCommandResponse("No configuration loaded. Cannot show portal URLs.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(ConfigReader.ConfigObject.SystemUrl) && string.IsNullOrEmpty(ConfigReader.ConfigObject.TemplateUrl))
|
||||||
|
{
|
||||||
|
CrestronConsole.ConsoleCommandResponse("No portal URLs defined in config.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CrestronConsole.ConsoleCommandResponse(
|
||||||
|
"This system can be found at the following URLs:{2}" +
|
||||||
|
"System URL: {0}{2}" +
|
||||||
|
"Template URL: {1}{2}",
|
||||||
|
ConfigReader.ConfigObject?.SystemUrl,
|
||||||
|
ConfigReader.ConfigObject?.TemplateUrl,
|
||||||
|
CrestronEnvironment.NewLine);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DeterminePlatform method
|
/// DeterminePlatform method
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -257,11 +274,6 @@ namespace PepperDash.Essentials
|
||||||
PluginLoader.AddProgramAssemblies();
|
PluginLoader.AddProgramAssemblies();
|
||||||
|
|
||||||
_ = new Core.DeviceFactory();
|
_ = new Core.DeviceFactory();
|
||||||
// _ = new Devices.Common.DeviceFactory();
|
|
||||||
// _ = new DeviceFactory();
|
|
||||||
|
|
||||||
// _ = new ProcessorExtensionDeviceFactory();
|
|
||||||
// _ = new MobileControlFactory();
|
|
||||||
|
|
||||||
LoadAssets(Global.ApplicationDirectoryPathPrefix, Global.FilePathPrefix);
|
LoadAssets(Global.ApplicationDirectoryPathPrefix, Global.FilePathPrefix);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue