mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
Merge 8cfd58bb7e into b3617d04c8
This commit is contained in:
@@ -358,14 +358,27 @@ namespace PepperDash.Essentials
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var assy = loadedAssembly.Assembly;
|
var assy = loadedAssembly.Assembly;
|
||||||
var types = assy.GetTypes();
|
CType[] types = {};
|
||||||
|
try
|
||||||
|
{
|
||||||
|
types = assy.GetTypes();
|
||||||
|
}
|
||||||
|
catch (TypeLoadException e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Unable to get types for assembly {0}: {1}",
|
||||||
|
loadedAssembly.Name, e.Message);
|
||||||
|
Debug.Console(2, e.StackTrace);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (typeof(IPluginDeviceFactory).IsAssignableFrom(type))
|
if (typeof (IPluginDeviceFactory).IsAssignableFrom(type))
|
||||||
{
|
{
|
||||||
var plugin = (IPluginDeviceFactory)Crestron.SimplSharp.Reflection.Activator.CreateInstance(type);
|
var plugin =
|
||||||
|
(IPluginDeviceFactory) Crestron.SimplSharp.Reflection.Activator.CreateInstance(type);
|
||||||
LoadCustomPlugin(plugin, loadedAssembly);
|
LoadCustomPlugin(plugin, loadedAssembly);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -378,18 +391,24 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (NotSupportedException e)
|
||||||
|
{
|
||||||
|
//this happens for dlls that aren't PD dlls, like ports of Mono classes into S#. Swallowing.
|
||||||
|
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(2, "Load Plugin not found. {0}.{2} is not a plugin factory. Exception: {1}",
|
Debug.Console(2, "Load Plugin not found. {0}.{2} is not a plugin factory. Exception: {1}",
|
||||||
loadedAssembly.Name, e, type.Name);
|
loadedAssembly.Name, e.Message, type.Name);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Console(2, "Error Loading Assembly: {0} Exception: {1} ", loadedAssembly.Name, e);
|
Debug.Console(0, Debug.ErrorLogLevel.Warning, "Error Loading assembly {0}: {1}",
|
||||||
|
loadedAssembly.Name, e.Message);
|
||||||
|
Debug.Console(2, "{0}", e.StackTrace);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user