Game Development Reference
In-Depth Information
The following method is a wrapper around executing a method of the plugin,
except this time with return values.
public object[] ExecuteMethodWithReturn(string interfaceName,
string method,
object[] parameters)
{
List<object> results = new List<object>();
foreach (IPlugin plugin in pluginInstances)
{
foreach (Type interfaceType in plugin.GetType().GetInterfaces())
{
if (interfaceType.Name.Equals(interfaceName))
{
results.Add(ExecuteMethodWithReturn(plugin,
method,
parameters));
}
}
}
return results.ToArray();
}
The following method is used to return metadata information about all the plugins
within the assembly.
public PluginInfo[] QueryPluginInformation()
{
return pluginInfo.ToArray();
}
#region Plugin Method Invocation
The following method uses reflection to call the Initialize() method directly on
the IPlugin instance.
private void ExecuteInitializeMethod(IPlugin plugin)
{
ExecuteMethodNoReturn(plugin, “Initialize”, null);
}
Search Nedrilad ::




Custom Search