public PublishedPlugin(IPluginPackageIndex pluginIndex) { Name = pluginIndex.Name; Author = pluginIndex.Author; Website = pluginIndex.Website; Description = pluginIndex.Description; RequiredInterfaces = pluginIndex.ImplementedPluginInterfaces .Select(x => new PluginInterface(x.InterfaceTypename, x.InterfaceVersion)) .ToList(); }
public static List <PluginError> FindCompatibilityErrors(IPluginPackageIndex index) { var errors = new List <PluginError>(); if (index.PluginArchiveVersion < PluginArchive.MinimumSupportedPluginArchiveVersion) { errors.Add(new PluginError("The plugin targets an older version of Tailviewer and must be compiled against the current version in order to be usable")); } if (index.PluginArchiveVersion > PluginArchive.CurrentPluginArchiveVersion) { errors.Add(new PluginError("The plugin targets a newer version of Tailviewer and must be compiled against the current version in order to be usable")); } if (index.ImplementedPluginInterfaces != null) { foreach (var implementation in index.ImplementedPluginInterfaces) { if (TryResolvePluginInterface(implementation, out var @interface)) { var currentInterfaceVersion = PluginInterfaceVersionAttribute.GetInterfaceVersion(@interface); var implementedInterfaceVersion = new PluginInterfaceVersion(implementation.InterfaceVersion); if (implementedInterfaceVersion < currentInterfaceVersion) { errors.Add(new PluginError($"The plugin implements an older version of '{@interface.FullName}'. It must target the current version in order to be usable!")); } else if (implementedInterfaceVersion > currentInterfaceVersion) { errors.Add(new PluginError($"The plugin implements a newer version of '{@interface.FullName}'. It must target the current version in order to be usable!")); } } else { // If a plugin unfortunately implements an interface that is not known to this tailviewer, // then it is bad news because that means we won't be able to load its assembly! errors.Add(new PluginError($"The plugin implements an unknown interface '{implementation.InterfaceTypename}' which is probably part of a newer tailviewer version. The plugin should target the current version in order to be usable!")); } } } return(errors); }
private static bool IsUsable(IPluginPackageIndex index) { if (index.PluginArchiveVersion < PluginArchive.MinimumSupportedPluginArchiveVersion) { return(false); } if (index.PluginArchiveVersion > PluginArchive.CurrentPluginArchiveVersion) { return(false); } // We might also want to discard plugins which are built against outdated APIs, but this // will probably have to be hard-coded, no? return(true); }
public static bool IsCompatible(IPluginPackageIndex index) { return(!FindCompatibilityErrors(index).Any()); }