aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Servers/Base/ServerUtils.cs19
-rw-r--r--OpenSim/Services/Base/ServiceBase.cs29
2 files changed, 45 insertions, 3 deletions
diff --git a/OpenSim/Servers/Base/ServerUtils.cs b/OpenSim/Servers/Base/ServerUtils.cs
index 4e8f472..834576b 100644
--- a/OpenSim/Servers/Base/ServerUtils.cs
+++ b/OpenSim/Servers/Base/ServerUtils.cs
@@ -96,6 +96,20 @@ namespace OpenSim.Servers.Base
96 96
97 public static T LoadPlugin<T>(string dllName, Object[] args) where T:class 97 public static T LoadPlugin<T>(string dllName, Object[] args) where T:class
98 { 98 {
99 string[] parts = dllName.Split(new char[] {':'});
100
101 dllName = parts[0];
102
103 string className = String.Empty;
104
105 if (parts.Length > 1)
106 className = parts[1];
107
108 return LoadPlugin<T>(dllName, className, args);
109 }
110
111 public static T LoadPlugin<T>(string dllName, string className, Object[] args) where T:class
112 {
99 string interfaceName = typeof(T).ToString(); 113 string interfaceName = typeof(T).ToString();
100 114
101 try 115 try
@@ -106,6 +120,11 @@ namespace OpenSim.Servers.Base
106 { 120 {
107 if (pluginType.IsPublic) 121 if (pluginType.IsPublic)
108 { 122 {
123 if (className != String.Empty &&
124 pluginType.ToString() !=
125 pluginType.Namespace + "." + className)
126 continue;
127
109 Type typeInterface = 128 Type typeInterface =
110 pluginType.GetInterface(interfaceName, true); 129 pluginType.GetInterface(interfaceName, true);
111 if (typeInterface != null) 130 if (typeInterface != null)
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 }