private IEnumerable <T> GetGlobalFilters(Zongsoft.Plugins.PluginTreeNode node, string method) { if (node == null) { yield break; } foreach (var child in node.Children) { if (child.NodeType == Plugins.PluginTreeNodeType.Empty) { continue; } if (this.ContainsHttpMethod(child.Properties.GetRawValue("method"), method)) { var filter = this.CreateFilter(child, FilterScope.Global); if (filter != null) { yield return(filter); } } } }
private Zongsoft.Plugins.PluginTreeNode GetCurrentNode(Zongsoft.Plugins.PluginTreeNode node, string url) { if (node == null || string.IsNullOrWhiteSpace(url)) { return(null); } foreach (var child in node.Children) { var foundNode = this.GetCurrentNode(child, url); if (foundNode != null) { return(foundNode); } } var treeNode = node.UnwrapValue(ObtainMode.Auto) as Zongsoft.Web.Controls.TreeViewNode; if (treeNode != null) { if ((!string.IsNullOrWhiteSpace(treeNode.NavigateUrl)) && url.StartsWith(treeNode.NavigateUrl, StringComparison.OrdinalIgnoreCase)) { return(node); } } return(null); }
internal Sitemap(Zongsoft.Plugins.PluginTreeNode sitemapNode) { if (sitemapNode == null) { throw new ArgumentNullException("sitemapNode"); } _sitemapNode = sitemapNode; }
private Zongsoft.Plugins.PluginTreeNode[] GetCurrentNodePath(Zongsoft.Plugins.PluginTreeNode currentNode) { if (currentNode == null) { return(null); } var stack = new Stack <Zongsoft.Plugins.PluginTreeNode>(); while (currentNode != null && currentNode != _sitemapNode) { stack.Push(currentNode); currentNode = currentNode.Parent; } //最后再将主页压入堆栈 stack.Push(_sitemapNode); return(stack.ToArray()); }
protected abstract T CreateFilter(Zongsoft.Plugins.PluginTreeNode node, FilterScope scope);