mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-07-02 10:38:16 +00:00
refactor: Extract portal URL display logic into a separate method for improved readability
This commit is contained in:
parent
9a385eef96
commit
bad08fa6db
1 changed files with 26 additions and 8 deletions
|
|
@ -177,14 +177,8 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig, IInitialization
|
||||||
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented));
|
(ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented));
|
||||||
}, "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);
|
||||||
|
|
@ -216,6 +210,30 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig, IInitialization
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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>
|
||||||
/// Determines if the program is running on a processor (appliance) or server (VC-4).
|
/// Determines if the program is running on a processor (appliance) or server (VC-4).
|
||||||
///
|
///
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue