Game Development Reference
In-Depth Information
return true;
}
catch (Exception)
{
return false;
}
}
The following method is used to determine whether the plugin assembly contains
any plugin classes that implement a particular interface. This is used to determine
which assemblies can handle a particular application component.
public bool ImplementsInterface(string interfaceName)
{
foreach (Type type in pluginTypes)
{
foreach (Type interfaceType in type.GetInterfaces())
{
if (interfaceType.Name.Equals(interfaceName))
return true;
}
}
return false;
}
The following method is used to instantiate all the plugins within an assembly,
execute the Initialize() method, and add the instantiated plugins to a list to keep
track of them.
public void Initialize()
{
bool exists = false;
foreach (Type type in pluginTypes)
{
foreach (IPlugin plugin in pluginInstances)
{
if (plugin.GetType().Equals(type))
{
exists = true;
break;
}
}
Search Nedrilad ::




Custom Search