public Task <IEnumerable <IPluginInfo> > GetEnabledPluginsAsync() { var enabledIds = _pluginManager.GetFeatures().Where(f => _engineDescriptor .Features.Any(sf => sf.Id == f.Id)).Select(f => f.Plugin.Id).Distinct().ToArray(); return(Task.FromResult(_pluginManager.GetPlugins().Where(e => enabledIds.Contains(e.Id)))); }
public IList <IPlugin> GetCorruptedPluginsWithEqualShortcut() { var pluginsWithEqualShortcut = new List <IPlugin>(); var shortcuts = new Dictionary <string, IPlugin>(); foreach (var plugin in _pluginManager.GetPlugins()) { if (plugin.Shortcut != null && !(plugin.IsExternal)) { if (!shortcuts.ContainsKey(plugin.Shortcut)) { shortcuts.Add(plugin.Shortcut, plugin); } else { pluginsWithEqualShortcut.Add(plugin); } } } return(pluginsWithEqualShortcut); }
public ModuleViewLocationExpanderProvider( IRazorViewEngineFileProviderAccessor fileProviderAccessor, IPluginManager pluginManager, EngineDescriptor engineDescriptor, IMemoryCache memoryCache) { _pluginManager = pluginManager; _engineDescriptor = engineDescriptor; _memoryCache = memoryCache; if (_modulesWithComponentViews != null) { return; } lock (_synLock) { if (_modulesWithComponentViews == null) { var modulesWithComponentViews = new List <IPluginInfo>(); var orderedModules = _pluginManager.GetPlugins() //.Where(e => e.Manifest.Type.Equals("module", StringComparison.OrdinalIgnoreCase)) .Reverse(); foreach (var module in orderedModules) { var moduleComponentsViewFilePaths = fileProviderAccessor.FileProvider.GetViewFilePaths( module.SubPath + "/Views/Shared/Components", new[] { RazorViewEngine.ViewExtension }, viewsFolder: null, inViewsFolder: true, inDepth: true); if (moduleComponentsViewFilePaths.Any()) { modulesWithComponentViews.Add(module); } } _modulesWithComponentViews = modulesWithComponentViews; } } }
protected override Task <IEnumerable <JObject> > GetViewOptionsAsync(RouteData routeData) { return(_pluginManager.GetPlugins().InvokeAsync(descriptor => _viewOptionLoader.LoadAsync(descriptor), _logger)); }
public virtual IEnumerable <string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable <string> viewLocations) { if (context.ActionContext.ActionDescriptor is PageActionDescriptor page) { var pageViewLocations = PageViewLocations().ToList(); pageViewLocations.AddRange(viewLocations); return(pageViewLocations); IEnumerable <string> PageViewLocations() { if (page.RelativePath.Contains("/Pages/") && !page.RelativePath.StartsWith("/Pages/", StringComparison.Ordinal)) { yield return(page.RelativePath.Substring(0, page.RelativePath.IndexOf("/Pages/", StringComparison.Ordinal)) + "/Views/Shared/{0}" + RazorViewEngine.ViewExtension); } } } var plugin = _pluginManager.GetPlugin(context.AreaName); if (!plugin.Exists) { return(viewLocations); } var result = new List <string>(); var pluginViewsPath = '/' + plugin.SubPath + "/Views"; result.Add(pluginViewsPath + "/{1}/{0}" + RazorViewEngine.ViewExtension); if (!context.ViewName.StartsWith("Components/", StringComparison.Ordinal)) { result.Add(pluginViewsPath + "/Shared/{0}" + RazorViewEngine.ViewExtension); } else { if (!_memoryCache.TryGetValue(CacheKey, out IEnumerable <string> moduleComponentViewLocations)) { var enabledIds = _pluginManager.GetFeatures().Where(f => _engineDescriptor .Features.Any(sf => sf.Id == f.Id)).Select(f => f.Plugin.Id).Distinct().ToArray(); var enabledExtensions = _pluginManager.GetPlugins() .Where(e => enabledIds.Contains(e.Id)).ToArray(); var sharedViewsPath = "/Views/Shared/{0}" + RazorViewEngine.ViewExtension; moduleComponentViewLocations = _modulesWithComponentViews .Where(m => enabledExtensions.Any(e => e.Id == m.Id)) .Select(m => '/' + m.SubPath + sharedViewsPath); _memoryCache.Set(CacheKey, moduleComponentViewLocations); } result.AddRange(moduleComponentViewLocations); } result.AddRange(viewLocations); return(result); }
public Task <IEnumerable <ProjectDescriptor> > HarvestProjectsAsync() { return(_pluginManager.GetPlugins().InvokeAsync(descriptor => HarvestProjectss(descriptor), Logger)); }
public List <IPlugin> GetPlugins() { return(_pluginManager.GetPlugins()); }
protected override Task <IEnumerable <JObject> > GetViewOptionsAsync(RouteData routeData) { return(_pluginManager.GetPlugins() .Where(e => e.Id == "SeedModules.Setup" || e.Id == "SeedModules.AngularUI") .InvokeAsync(descriptor => _viewOptionLoader.LoadAsync(descriptor), _logger)); }