public NamespaceInclude GetNestedInclude(string diagram) { // Checks the 'diagram' against the 'selector'. bool CheckDiagram(Selector selector) { return(selector.DiagramSelector.Select(diagram)); } // Filtered selectors. IEnumerable <Selector> filtered = this.selectors .Where(CheckDiagram); // Concatenates all namespace permissions for the 'diagram'. NamespaceInclude namespaceInclude = filtered.Aggregate(NamespaceInclude.None, (acc, selector) => acc | selector.NestedInclude); return(namespaceInclude); }
public NamespaceInclude GetNamespaceInclude(Type type, string diagram) { // Checks the namespace of 'type' and the 'diagram' against the 'selector'. bool CheckNamespaceAndDiagram(Selector selector) { return(selector.NamespaceSelector.Select(type.Namespace) && selector.DiagramSelector.Select(diagram)); } // Filtered selectors. IEnumerable <Selector> filtered = this.selectors .Where(CheckNamespaceAndDiagram); // Concatenates all namespace permissions related to the namespace of 'type' for the 'diagram'. NamespaceInclude namespaceInclude = filtered.Aggregate(NamespaceInclude.None, (acc, selector) => acc | selector.DefaultNamespaceInclude); return(namespaceInclude); }
public static bool Check(this NamespaceInclude flags, Type type) { return(flags.DecomposeFlag().Any(flag => fastNamespaceCheck[flag](type))); }