@@ -27,7 +27,7 @@ public class ControlSystem : CrestronControlSystem, ILoadConfig
2727 private CEvent _initializeEvent ;
2828 private const long StartupTime = 500 ;
2929
30- private const string minimumFirmwareVersion = "2.8006.00110" ;
30+ // private const string minimumFirmwareVersion = "2.8006.00110";
3131
3232 /// <summary>
3333 /// Initializes a new instance of the ControlSystem class
@@ -50,21 +50,21 @@ public override void InitializeSystem()
5050 {
5151
5252 // Get FW version and stop if it's too low to run this version of Essentials. Must be greater than v2.8006.00110
53- var fwVersion = InitialParametersClass . FirmwareVersion ;
54-
55- Debug . LogInformation ( "Control System Hardware Version: {fwVersion}" , fwVersion ) ;
56-
57- // split the version into parts and compare against minimumFirmwareVersion
58- var versionParts = fwVersion . Split ( '.' ) . Select ( int . Parse ) . ToArray ( ) ;
59- var minParts = minimumFirmwareVersion . Split ( '.' ) . Select ( int . Parse ) . ToArray ( ) ;
60- if ( versionParts . Length < minParts . Length
61- || versionParts [ 0 ] < minParts [ 0 ]
62- || ( versionParts [ 0 ] == minParts [ 0 ] && versionParts [ 1 ] < minParts [ 1 ] )
63- || ( versionParts [ 0 ] == minParts [ 0 ] && versionParts [ 1 ] == minParts [ 1 ] && versionParts [ 2 ] <= minParts [ 2 ] ) )
64- {
65- Debug . LogFatal ( "Firmware version {fwVersion} is too low to run this version of Essentials. Please upgrade to greater than v{minimumFirmwareVersion}." , fwVersion , minimumFirmwareVersion ) ;
66- return ;
67- }
53+ // var fwVersion = InitialParametersClass.FirmwareVersion;
54+
55+ // Debug.LogInformation("Control System Hardware Version: {fwVersion}", fwVersion);
56+
57+ // // split the version into parts and compare against minimumFirmwareVersion
58+ // var versionParts = fwVersion.Split('.').Select(int.Parse).ToArray();
59+ // var minParts = minimumFirmwareVersion.Split('.').Select(int.Parse).ToArray();
60+ // if (versionParts.Length < minParts.Length
61+ // || versionParts[0] < minParts[0]
62+ // || (versionParts[0] == minParts[0] && versionParts[1] < minParts[1])
63+ // || (versionParts[0] == minParts[0] && versionParts[1] == minParts[1] && versionParts[2] <= minParts[2]))
64+ // {
65+ // Debug.LogFatal("Firmware version {fwVersion} is too low to run this version of Essentials. Please upgrade to greater than v{minimumFirmwareVersion}.", fwVersion, minimumFirmwareVersion);
66+ // return;
67+ // }
6868
6969 // If the control system is a DMPS type, we need to wait to exit this method until all devices have had time to activate
7070 // to allow any HD-BaseT DM endpoints to register first.
@@ -130,14 +130,8 @@ private void StartSystem(object preventInitialization)
130130 ( ConfigReader . ConfigObject , Newtonsoft . Json . Formatting . Indented ) . Replace ( Environment . NewLine , "\r \n " ) ) ;
131131 } , "showconfig" , "Shows the current running merged config" , ConsoleAccessLevelEnum . AccessOperator ) ;
132132
133- CrestronConsole . AddNewConsoleCommand ( s =>
134- CrestronConsole . ConsoleCommandResponse (
135- "This system can be found at the following URLs:{2}" +
136- "System URL: {0}{2}" +
137- "Template URL: {1}{2}" ,
138- ConfigReader . ConfigObject . SystemUrl ,
139- ConfigReader . ConfigObject . TemplateUrl ,
140- CrestronEnvironment . NewLine ) ,
133+ CrestronConsole . AddNewConsoleCommand (
134+ PrintPortalInfo ,
141135 "portalinfo" ,
142136 "Shows portal URLS from configuration" ,
143137 ConsoleAccessLevelEnum . AccessOperator ) ;
@@ -160,6 +154,29 @@ private void StartSystem(object preventInitialization)
160154 }
161155 }
162156
157+ private void PrintPortalInfo ( string args )
158+ {
159+ if ( ConfigReader . ConfigObject == null )
160+ {
161+ CrestronConsole . ConsoleCommandResponse ( "No configuration loaded. Cannot show portal URLs." ) ;
162+ return ;
163+ }
164+
165+ if ( string . IsNullOrEmpty ( ConfigReader . ConfigObject . SystemUrl ) && string . IsNullOrEmpty ( ConfigReader . ConfigObject . TemplateUrl ) )
166+ {
167+ CrestronConsole . ConsoleCommandResponse ( "No portal URLs defined in config." ) ;
168+ return ;
169+ }
170+
171+ CrestronConsole . ConsoleCommandResponse (
172+ "This system can be found at the following URLs:{2}" +
173+ "System URL: {0}{2}" +
174+ "Template URL: {1}{2}" ,
175+ ConfigReader . ConfigObject ? . SystemUrl ,
176+ ConfigReader . ConfigObject ? . TemplateUrl ,
177+ CrestronEnvironment . NewLine ) ;
178+ }
179+
163180 /// <summary>
164181 /// DeterminePlatform method
165182 /// </summary>
@@ -257,11 +274,6 @@ public void GoWithLoad()
257274 PluginLoader . AddProgramAssemblies ( ) ;
258275
259276 _ = new Core . DeviceFactory ( ) ;
260- // _ = new Devices.Common.DeviceFactory();
261- // _ = new DeviceFactory();
262-
263- // _ = new ProcessorExtensionDeviceFactory();
264- // _ = new MobileControlFactory();
265277
266278 LoadAssets ( Global . ApplicationDirectoryPathPrefix , Global . FilePathPrefix ) ;
267279
@@ -274,10 +286,9 @@ public void GoWithLoad()
274286 PluginLoader . LoadPlugins ( ) ;
275287
276288 Debug . LogMessage ( LogEventLevel . Information , "Folder structure verified. Loading config..." ) ;
277- if ( ! ConfigReader . LoadConfig2 ( ) )
289+ if ( ! ConfigReader . LoadConfig2 ( ) || ConfigReader . ConfigObject == null )
278290 {
279- Debug . LogMessage ( LogEventLevel . Information , "Essentials Load complete with errors" ) ;
280- return ;
291+ Debug . LogMessage ( LogEventLevel . Warning , "Unable to load config file." ) ;
281292 }
282293
283294 Load ( ) ;
@@ -399,6 +410,12 @@ public void LoadDevices()
399410 new Core . Monitoring . SystemMonitorController ( "systemMonitor" ) ) ;
400411 }
401412
413+ if ( ConfigReader . ConfigObject is null )
414+ {
415+ Debug . LogMessage ( LogEventLevel . Warning , "LoadDevices: ConfigObject is null. Cannot load devices." ) ;
416+ return ;
417+ }
418+
402419 foreach ( var devConf in ConfigReader . ConfigObject . Devices )
403420 {
404421 IKeyed newDev = null ;
@@ -452,7 +469,7 @@ public void LoadTieLines()
452469
453470 var tlc = TieLineCollection . Default ;
454471
455- if ( ConfigReader . ConfigObject . TieLines == null )
472+ if ( ConfigReader . ConfigObject ? . TieLines == null )
456473 {
457474 return ;
458475 }
@@ -749,7 +766,7 @@ private string GetSwitchDescription(RouteSwitchDescriptor route)
749766 /// </summary>
750767 public void LoadRooms ( )
751768 {
752- if ( ConfigReader . ConfigObject . Rooms == null )
769+ if ( ConfigReader . ConfigObject ? . Rooms == null )
753770 {
754771 Debug . LogMessage ( LogEventLevel . Information , "Notice: Configuration contains no rooms - Is this intentional? This may be a valid configuration." ) ;
755772 return ;
@@ -786,13 +803,13 @@ public void LoadRooms()
786803 /// </summary>
787804 void LoadLogoServer ( )
788805 {
789- if ( ConfigReader . ConfigObject . Rooms == null )
806+ if ( ConfigReader . ConfigObject ? . Rooms == null )
790807 {
791808 Debug . LogMessage ( LogEventLevel . Information , "No rooms configured. Bypassing Logo server startup." ) ;
792809 return ;
793810 }
794811
795- if (
812+ if ( ConfigReader . ConfigObject ? . Rooms == null ||
796813 ! ConfigReader . ConfigObject . Rooms . Any (
797814 CheckRoomConfig ) )
798815 {
0 commit comments