diff options
Diffstat (limited to 'OpenSim/Services/Base/ServiceBase.cs')
-rw-r--r-- | OpenSim/Services/Base/ServiceBase.cs | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/OpenSim/Services/Base/ServiceBase.cs b/OpenSim/Services/Base/ServiceBase.cs index 800b172..c8a924b 100644 --- a/OpenSim/Services/Base/ServiceBase.cs +++ b/OpenSim/Services/Base/ServiceBase.cs | |||
@@ -36,6 +36,25 @@ namespace OpenSim.Services.Base | |||
36 | { | 36 | { |
37 | public T LoadPlugin<T>(string dllName) where T:class | 37 | public T LoadPlugin<T>(string dllName) where T:class |
38 | { | 38 | { |
39 | return LoadPlugin<T>(dllName, new Object[0]); | ||
40 | } | ||
41 | |||
42 | public T LoadPlugin<T>(string dllName, Object[] args) where T:class | ||
43 | { | ||
44 | string[] parts = dllName.Split(new char[] {':'}); | ||
45 | |||
46 | dllName = parts[0]; | ||
47 | |||
48 | string className = String.Empty; | ||
49 | |||
50 | if (parts.Length > 1) | ||
51 | className = parts[1]; | ||
52 | |||
53 | return LoadPlugin<T>(dllName, className, args); | ||
54 | } | ||
55 | |||
56 | public T LoadPlugin<T>(string dllName, string className, Object[] args) where T:class | ||
57 | { | ||
39 | string interfaceName = typeof(T).ToString(); | 58 | string interfaceName = typeof(T).ToString(); |
40 | 59 | ||
41 | try | 60 | try |
@@ -46,13 +65,17 @@ namespace OpenSim.Services.Base | |||
46 | { | 65 | { |
47 | if (pluginType.IsPublic) | 66 | if (pluginType.IsPublic) |
48 | { | 67 | { |
68 | if (className != String.Empty && | ||
69 | pluginType.ToString() != | ||
70 | pluginType.Namespace + "." + className) | ||
71 | continue; | ||
72 | |||
49 | Type typeInterface = | 73 | Type typeInterface = |
50 | pluginType.GetInterface(interfaceName, true); | 74 | pluginType.GetInterface(interfaceName, true); |
51 | if (typeInterface != null) | 75 | if (typeInterface != null) |
52 | { | 76 | { |
53 | T plug = (T)Activator.CreateInstance( | 77 | T plug = (T)Activator.CreateInstance(pluginType, |
54 | pluginAssembly.GetType( | 78 | args); |
55 | pluginType.ToString())); | ||
56 | 79 | ||
57 | return plug; | 80 | return plug; |
58 | } | 81 | } |