public virtual Filters GetFilters() { Filters filters = null; using (IDbConnection cnc = GetConnection ()) { IDbCommand cmd = cnc.CreateCommand (); cmd.CommandText = "SELECT is_rx, name_filter, typename_filter FROM filters"; using (IDataReader reader = cmd.ExecuteReader ()) { filters = new Filters (reader); } } return filters; }
static bool FilterNode (Filters filters, ComparisonNode node) { if (filters.Filter (node.Name, node.TypeName)) { //Console.WriteLine ("OUT: '{0}' '{1}'", node.Name, node.TypeName); return true; } List<ComparisonNode> removed = null; foreach (ComparisonNode child in node.Children) { if (FilterNode (filters, child)) { if (removed == null) removed = new List<ComparisonNode> (); removed.Add (child); } } if (removed == null) return false; foreach (ComparisonNode child in removed) node.Children.Remove (child); return false; }