public void Add(Contex contex, GlueLogicOperator glueLogicOperator = GlueLogicOperator.And, bool not = false) { if (Contexies.Count == 0) { glueLogicOperator = GlueLogicOperator.And; } Contexies.Add(CreateEntry(contex, glueLogicOperator, not)); }
public bool Check() { bool result = true; foreach (Entry entry in Contexies) { dynamic daContex = entry.Contex; if (entry == Contexies.First()) { switch (entry.Glue) { case GlueLogicOperator.And: result = true; break; case GlueLogicOperator.Or: result = false; break; } } var checkResult = daContex.Check(); if (entry.Not) { checkResult = !checkResult; } switch (entry.Glue) { case GlueLogicOperator.And: result = result && checkResult; break; case GlueLogicOperator.Or: result = result || checkResult; break; } } return(result); }