private bool DiscoverRuntimePlugin(PluginManifest manifest, Assembly assembly) { var hasSpecificType = !string.IsNullOrEmpty(manifest.PluginTypeName); var pluginType = hasSpecificType ? assembly.GetType(manifest.PluginTypeName) : null; if (hasSpecificType && pluginType == null) { return(false); } var activator = pluginType == null ? _pluginActivator : DefaultPluginActivator(pluginType); var plugin = activator.Invoke(manifest, assembly); if (plugin != null) { manifest.RuntimeInfo.Plugin = plugin; manifest.RuntimeInfo.PluginAssembly = assembly; manifest.RuntimeInfo.PluginType = plugin.GetType(); if (!_pluginAssemblies.Contains(assembly)) { _pluginAssemblies.Add(assembly); } } return(manifest.RuntimeInfo.Plugin != null); }
private static void ValidateMinVersionCompatibility(PluginDependency dependency, PluginManifest dependencyManifest, List <string> errorMessages) { if (dependency.MinVersion != null && dependency.MinVersion != default(Version) && (dependencyManifest.PluginVersion == null || dependency.MinVersion > dependencyManifest.PluginVersion)) { errorMessages.Add( string.Format(ErrorMessages.PluginDependencyMinVersionConflictFormat, dependency.PluginId, dependencyManifest.PluginVersion == null ? "" : dependencyManifest.PluginVersion.ToString(3), dependency.MinVersion.ToString(3))); } }
private static void ValidateVersionCompatibility(PluginDependency dependency, PluginManifest dependencyManifest, List <string> errorMessages) { ValidateMinVersionCompatibility(dependency, dependencyManifest, errorMessages); ValidateMaxVersionCompatibility(dependency, dependencyManifest, errorMessages); }
public abstract Task SavePluginManifestAsync(PluginManifest manifest);