diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index b7ce9288..e4d4cbc0 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -81,31 +81,52 @@ namespace PepperDash.Essentials "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); - LoadDeviceTypesFromFactories(); if (!Debug.DoNotLoadOnNextBoot) GoWithLoad(); } /// - /// Instantiates each of the device factories to load thier device types + /// Instantiates each of the device factories to load their device types /// void LoadDeviceTypesFromFactories() { - // Instantiate the Device Factories - new CoreDeviceFactory(); - new DmDeviceFactory(); - new UiDeviceFactory(); + PluginLoader.AddProgramAssemblies(); - new DeviceFactory(); - new BridgeFactory(); - new PepperDash.Essentials.Devices.Common.DeviceFactory(); - new PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory(); + foreach (var assembly in PluginLoader.LoadedAssemblies) + { + if (!assembly.Name.Contains("Essentials")) + { + continue; + } + else + { + var assy = assembly.Assembly; + var types = assy.GetTypes(); + + if (types != null) + { + foreach (var type in types) + { + try + { + if (typeof(IDeviceFactory).IsAssignableFrom(type)) + { + var factory = (IDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type); + factory.LoadTypeFactories(); + } + } + catch (Exception e) + { + Debug.Console(0, Debug.ErrorLogLevel.Error, "Unable to load DeviceFactory: {0}", e); + } + } + } + } + } } - - /// /// Determines if the program is running on a processor (appliance) or server (VC-4). /// @@ -184,9 +205,9 @@ namespace PepperDash.Essentials { Debug.SetDoNotLoadOnNextBoot(false); - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration"); + LoadDeviceTypesFromFactories(); - PluginLoader.AddProgramAssemblies(); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration"); var filesReady = SetupFilesystem(); if (filesReady) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs index 3e08d698..d32e9efa 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs @@ -71,9 +71,22 @@ namespace PepperDash.Essentials assembly = Assembly.GetExecutingAssembly(); break; } - case ("PepperDashEssentialsBase.dll"): + case ("PepperDash_Essential_Core.dll"): { - + version = Global.AssemblyVersion; + assembly = System.Reflection + break; + } + case ("PepperDash_Essentials_DM.dll"): + { + version = Global.AssemblyVersion; + assembly = Assembly.GetExecutingAssembly(); + break; + } + case ("Essentials Devices Common.dll"): + { + version = Global.AssemblyVersion; + assembly = Assembly.GetExecutingAssembly(); break; } case ("PepperDash_Core.dll"): diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs index 78043111..735df48c 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SoftCodec/BlueJeansPc.cs @@ -166,7 +166,7 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec { public BlueJeansPcFactory() { - TypeNames = new List() { "mockvc" }; + TypeNames = new List() { "bluejeanspc" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc)