mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-13 19:54:59 +00:00
Moves to reflection based mechanism for loading device factories at boot (not working)
This commit is contained in:
@@ -81,31 +81,52 @@ namespace PepperDash.Essentials
|
|||||||
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
|
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
|
||||||
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
|
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
|
||||||
|
|
||||||
LoadDeviceTypesFromFactories();
|
|
||||||
|
|
||||||
if (!Debug.DoNotLoadOnNextBoot)
|
if (!Debug.DoNotLoadOnNextBoot)
|
||||||
GoWithLoad();
|
GoWithLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Instantiates each of the device factories to load thier device types
|
/// Instantiates each of the device factories to load their device types
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void LoadDeviceTypesFromFactories()
|
void LoadDeviceTypesFromFactories()
|
||||||
{
|
{
|
||||||
// Instantiate the Device Factories
|
PluginLoader.AddProgramAssemblies();
|
||||||
new CoreDeviceFactory();
|
|
||||||
new DmDeviceFactory();
|
|
||||||
new UiDeviceFactory();
|
|
||||||
|
|
||||||
new DeviceFactory();
|
|
||||||
new BridgeFactory();
|
|
||||||
|
|
||||||
new PepperDash.Essentials.Devices.Common.DeviceFactory();
|
foreach (var assembly in PluginLoader.LoadedAssemblies)
|
||||||
new PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory();
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <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).
|
||||||
///
|
///
|
||||||
@@ -184,9 +205,9 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
Debug.SetDoNotLoadOnNextBoot(false);
|
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();
|
var filesReady = SetupFilesystem();
|
||||||
if (filesReady)
|
if (filesReady)
|
||||||
|
|||||||
@@ -71,9 +71,22 @@ namespace PepperDash.Essentials
|
|||||||
assembly = Assembly.GetExecutingAssembly();
|
assembly = Assembly.GetExecutingAssembly();
|
||||||
break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case ("PepperDash_Core.dll"):
|
case ("PepperDash_Core.dll"):
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec
|
|||||||
{
|
{
|
||||||
public BlueJeansPcFactory()
|
public BlueJeansPcFactory()
|
||||||
{
|
{
|
||||||
TypeNames = new List<string>() { "mockvc" };
|
TypeNames = new List<string>() { "bluejeanspc" };
|
||||||
}
|
}
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
|||||||
Reference in New Issue
Block a user