I'm just wondering what the appropriate 'architecture' is: give the program the ability to support plugins, or just include the new services through updates.
I know this is a stupid question, but I just want some sake of mind




Posted 15 July 2011 - 12:25 AM
Posted 15 July 2011 - 12:46 AM
Posted 15 July 2011 - 01:28 AM
This post has been edited by wiero: 15 July 2011 - 01:29 AM
Posted 15 July 2011 - 02:07 AM
Posted 15 July 2011 - 04:35 AM
pulic interface IPlugin
{
public string Name { get; }
public string Version { get; }
// plugin methods
}
//loading assemblies
foreach (string filePath in Directory.GetFiles(PLUGIN_FOLDER,"*.dll"))
{
Assembly.LoadFrom(filePath)
}
List<IPlugin> plugins = new List<IPlugin>();
//creating plugin instances
foreach (var type in AppDomain.CurrentDomain
.GetAssemblies().SelectMany(x => x.GetTypes())
.Where(t => t.IsAssignableTo<IComponent>() && (t.IsClass && !t.IsAbstract)))
{
// IPlugin must have parameterless constructor in this case
plugins.add(Activator.CreateInstance(type));
}
public static bool IsAssignableTo<T>(this Type that)
{
return typeof(T).IsAssignableFrom(that);
}
This post has been edited by wiero: 15 July 2011 - 04:35 AM
Posted 15 July 2011 - 05:35 AM
|
|
Query failed: connection to localhost:3312 failed (errno=111, msg=Connection refused).
|
