mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Create a generic way for passing constructor args to plugins
The old syntax didn't allow for any parameters except for services listed in the ServiceList. Now, services loaded by other services can also be made to use different ini sections or have additional paramters. Syntax is: [<ExtraParam>@]...<DllName>[:<ClassName>]
This commit is contained in:
@@ -242,6 +242,18 @@ namespace OpenSim.Server.Base
|
||||
className = parts[2];
|
||||
}
|
||||
|
||||
// Handle extra string arguments in a more generic way
|
||||
if (dllName.Contains("@"))
|
||||
{
|
||||
string[] dllNameParts = dllName.Split(new char[] {'@'});
|
||||
dllName = dllNameParts[dllNameParts.Length - 1];
|
||||
List<Object> argList = new List<Object>(args);
|
||||
for (int i = 0 ; i < dllNameParts.Length - 1 ; ++i)
|
||||
argList.Add(dllNameParts[i]);
|
||||
|
||||
args = argList.ToArray();
|
||||
}
|
||||
|
||||
return LoadPlugin<T>(dllName, className, args);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user