public string GetVersion(string pluginId) { var plugin = _pluginEngine.Get(pluginId); if (plugin == null) { return(null); } return(plugin.Package.Version.ToString()); }
public void Handle(PluginErrorMessage message) { var failedPlugin = _pluginEngine.Get(message.PluginId); if (failedPlugin == null) { return; } var unloadOrder = _pluginEngine.GetUnloadOrder(message.PluginId); foreach (var pluginId in unloadOrder) { _pluginEngine.Unload(pluginId); } if (failedPlugin.ErrorCount >= MaxErrorCount) { _logger.Error("Plugin {PluginId} has failed {ErrorCount} or more times. Not reloading.", message.PluginId, MaxErrorCount); return; } foreach (var pluginId in unloadOrder.Reverse()) { _pluginEngine.Load(pluginId); } }
public PluginsModule(IPluginEngine pluginEngine, IJsonRpcClient rpcClient) : base("plugins") { Get["/{id}/{path*}"] = _ => { string id = _.id; string path = _.path; var plugin = pluginEngine.Get(id); if (plugin == null) { return(404); } var data = rpcClient.Call <byte[]>(string.Format("{0}.resource.get", id), new[] { path }); if (data == null) { return(404); } var contentType = MimeTypes.GetMimeType(path); return(Response.FromStream(() => new MemoryStream(data), contentType)); }; }
public PluginsModule(IPluginEngine pluginEngine, IJsonRpcClient rpcClient) : base("plugins") { Get["/{id}/{path*}"] = _ => { string id = _.id; string path = _.path; var plugin = pluginEngine.Get(id); if (plugin == null) { return 404; } var data = rpcClient.Call<byte[]>(string.Format("{0}.resource.get", id), new[] {path}); if (data == null) { return 404; } var contentType = MimeTypes.GetMimeType(path); return Response.FromStream(() => new MemoryStream(data), contentType); }; }