aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Base/ServiceBase.cs
diff options
context:
space:
mode:
authorMelanie Thielker2009-05-10 22:31:10 +0000
committerMelanie Thielker2009-05-10 22:31:10 +0000
commitb2111f6a19235f38c90dad26c7bf041b950b0bd7 (patch)
tree3ed4621f54b1203232f804d3b4c3266c99f5fad2 /OpenSim/Services/Base/ServiceBase.cs
parent* Rather than crash the region simulator, declare the teleport a failure if t... (diff)
downloadopensim-SC-b2111f6a19235f38c90dad26c7bf041b950b0bd7.zip
opensim-SC-b2111f6a19235f38c90dad26c7bf041b950b0bd7.tar.gz
opensim-SC-b2111f6a19235f38c90dad26c7bf041b950b0bd7.tar.bz2
opensim-SC-b2111f6a19235f38c90dad26c7bf041b950b0bd7.tar.xz
Enhance the submodule loader and port the enhancements to the services base
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/Base/ServiceBase.cs29
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 }