From 7d89e122930be39e84a6d174548fa2d12ac0484a Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 6 Sep 2008 07:52:41 +0000 Subject: * This is the fabled LibOMV update with all of the libOMV types from JHurliman * This is a HUGE OMG update and will definitely have unknown side effects.. so this is really only for the strong hearted at this point. Regular people should let the dust settle. * This has been tested to work with most basic functions. However.. make sure you back up 'everything' before using this. It's that big! * Essentially we're back at square 1 in the testing phase.. so lets identify things that broke. --- .../Region/Physics/Manager/PhysicsPluginManager.cs | 88 +++++++++++++++------- 1 file changed, 59 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs') diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 3d9207f..db41251 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs @@ -115,43 +115,73 @@ namespace OpenSim.Region.Physics.Manager // that the LoadFrom context be avoided. This can be done by installing assemblies in the // Global Assembly Cache or in the ApplicationBase directory and using Assembly. // Load when explicitly loading assemblies. - Assembly pluginAssembly = Assembly.LoadFrom(FileName); + Assembly pluginAssembly = null; + Type[] types = null; - foreach (Type pluginType in pluginAssembly.GetTypes()) + try { - if (pluginType.IsPublic) - { - if (!pluginType.IsAbstract) - { - Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true); - - if (physTypeInterface != null) - { - IPhysicsPlugin plug = - (IPhysicsPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - plug.Init(); - if (!_PhysPlugins.ContainsKey(plug.GetName())) - { - _PhysPlugins.Add(plug.GetName(), plug); - m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); - } - } + pluginAssembly = Assembly.LoadFrom(FileName); + } + catch (Exception ex) + { + m_log.Error("Failed to load plugin from " + FileName, ex); + } - Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true); + if (pluginAssembly != null) + { + try + { + types = pluginAssembly.GetTypes(); + } + catch (ReflectionTypeLoadException ex) + { + m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName + ": " + + ex.LoaderExceptions[0].Message, ex); + } + catch (Exception ex) + { + m_log.Error("[PHYSICS]: Failed to enumerate types in plugin from " + FileName, ex); + } - if (meshTypeInterface != null) + if (types != null) + { + foreach (Type pluginType in types) + { + if (pluginType.IsPublic) { - IMeshingPlugin plug = - (IMeshingPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); - if (!_MeshPlugins.ContainsKey(plug.GetName())) + if (!pluginType.IsAbstract) { - _MeshPlugins.Add(plug.GetName(), plug); - m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); + Type physTypeInterface = pluginType.GetInterface("IPhysicsPlugin", true); + + if (physTypeInterface != null) + { + IPhysicsPlugin plug = + (IPhysicsPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + plug.Init(); + if (!_PhysPlugins.ContainsKey(plug.GetName())) + { + _PhysPlugins.Add(plug.GetName(), plug); + m_log.Info("[PHYSICS]: Added physics engine: " + plug.GetName()); + } + } + + Type meshTypeInterface = pluginType.GetInterface("IMeshingPlugin", true); + + if (meshTypeInterface != null) + { + IMeshingPlugin plug = + (IMeshingPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); + if (!_MeshPlugins.ContainsKey(plug.GetName())) + { + _MeshPlugins.Add(plug.GetName(), plug); + m_log.Info("[PHYSICS]: Added meshing engine: " + plug.GetName()); + } + } + + physTypeInterface = null; + meshTypeInterface = null; } } - - physTypeInterface = null; - meshTypeInterface = null; } } } -- cgit v1.1