/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public async Task <object> Get(GetPlugins request) { var result = _appHost.Plugins.OrderBy(p => p.Name).Select(p => p.GetPluginInfo()).ToList(); // Don't fail just on account of image url's try { var packages = (await _installationManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None)) .ToList(); foreach (var plugin in result) { var pkg = packages.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i.guid) && new Guid(plugin.Id).Equals(new Guid(i.guid))); if (pkg != null) { plugin.ImageUrl = pkg.thumbImage; } } } catch { } return(ToOptimizedSerializedResultUsingCache(result)); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public async Task <object> Get(GetPlugins request) { var result = _appHost.Plugins.OrderBy(p => p.Name).Select(p => p.GetPluginInfo()).ToList(); var requireAppStoreEnabled = request.IsAppStoreEnabled.HasValue && request.IsAppStoreEnabled.Value; // Don't fail just on account of image url's try { var packages = (await _installationManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None)) .ToList(); foreach (var plugin in result) { var pkg = packages.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i.guid) && string.Equals(i.guid.Replace("-", string.Empty), plugin.Id.Replace("-", string.Empty), StringComparison.OrdinalIgnoreCase)); if (pkg != null) { plugin.ImageUrl = pkg.thumbImage; } } if (requireAppStoreEnabled) { result = result .Where(plugin => { var pkg = packages.FirstOrDefault(i => !string.IsNullOrWhiteSpace(i.guid) && new Guid(plugin.Id).Equals(new Guid(i.guid))); return(pkg != null && pkg.enableInAppStore); }) .ToList(); } } catch { //Logger.ErrorException("Error getting plugin list", ex); // Play it safe here if (requireAppStoreEnabled) { result = new List <PluginInfo>(); } } return(ToOptimizedSerializedResultUsingCache(result)); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetPlugins request) { var result = _appHost.Plugins.OrderBy(p => p.Name).Select(p => p.GetPluginInfo()).ToArray(); return(ToOptimizedResult(result)); }
/// <summary> /// Gets the specified request. /// </summary> /// <param name="request">The request.</param> /// <returns>System.Object.</returns> public object Get(GetPlugins request) { var result = _appHost.Plugins.OrderBy(p => p.Name).Select(p => p.GetPluginInfo()).ToList(); return(ToOptimizedSerializedResultUsingCache(result)); }