private void LoadAssembly(Assembly assembly, string hash) { foreach (var type in assembly.GetExportedTypes()) { if (typeof(IPlugin).IsAssignableFrom(type) && (type.IsAbstract == false)) { var attribute = type.GetCustomAttribute <PluginAttribute>(); if (attribute != null) { var plugin = new PluginInstance(hash, assembly, type, attribute); if (!_plugins.ContainsKey(plugin.Id)) { _plugins.Add(plugin.Id, plugin); Log.LogDebug("Loaded plugin [id: {0}, name: {1}, type: {2}, version: {3}]", plugin.Id, plugin.Name, type.FullName, plugin.Version); } } } } }
private void LoadAssembly(Assembly assembly, string hash) { foreach (var type in assembly.GetExportedTypes()) { if (typeof(IPlugin).IsAssignableFrom(type) && (type.IsAbstract == false)) { var attribute = type.GetCustomAttribute <PluginAttribute>(); if (attribute != null) { var plugin = new PluginInstance(hash, assembly, type, attribute); if (!_plugins.ContainsKey(plugin.Id)) { _plugins.Add(plugin.Id, plugin); Log.LogDebug("Loaded plugin [id: {0}, name: {1}]", plugin.Id, plugin.ToString()); } _plugins = _plugins.OrderBy(p => p.Value.Name).ToDictionary(p => p.Key, p => p.Value); } } } }