static void Main(string[] args) { Dec dec = new Dec(12); CheckRules checks = new CheckRules(); CheckRules subc = new CheckRules(); subc.Add(Operator.NONE, new CheckRule(Operator.LT, 12)); CheckRules subcc = new CheckRules(); subcc.Add(Operator.NONE, new CheckRule(Operator.GT, 10)); dec.SetCheckRules( checks .Add(Operator.NONE, new CheckRule(Operator.LT, 13)) .Add(Operator.AND, new CheckRule(Operator.GT, 11)) .Add(Operator.OR, subc.Add(Operator.AND, subcc)) ); Trace.WriteLine(dec.IsNotNull()); Trace.WriteLine(dec.HasValidValue()); Trace.WriteLine("End"); }
public Compiler(IAstModuleLoader moduleLoader) { Context = new CompilerContext(moduleLoader); _astBuilder = new AstBuilder(Context); _resolveDefinition = new ResolveDefinition(Context); _checkRules = new CheckRules(Context); }
void menuCheck_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this._openFilePath)) { SharedLogic.ShowMessage("请先打开需要验证的文件"); return; } if (CheckRules.CheckFile(this._openFilePath)) { SharedLogic.ShowMessage("文件格式正确有效"); } }
public List<SqlCop.ServiceModel.RuleProblem> Post(CheckRules request) { var engine = new Engine(); var list = engine.RunRules(request.Sql, request.Rules); return list.Select(s => new SqlCop.ServiceModel.RuleProblem { Description = s.Description, ErrorMessageString = s.ErrorMessageString, Severity = s.Severity, StartColumn = s.StartColumn, StartLine = s.StartLine }).ToList(); }
public List <SqlCop.ServiceModel.RuleProblem> Post(CheckRules request) { var engine = new Engine(); var list = engine.RunRules(request.Sql, request.Rules); return(list.Select(s => new SqlCop.ServiceModel.RuleProblem { Description = s.Description, ErrorMessageString = s.ErrorMessageString, Severity = s.Severity, StartColumn = s.StartColumn, StartLine = s.StartLine }).ToList()); }
public ActionResult Index(Home model) { var homeModel = BuildModel(); homeModel.Sql = model.Sql; var dto = new CheckRules { Sql = model.Sql, Rules = new List <RuleModel>() }; if (model.SelectedRules != null) { foreach (string ruleId in model.SelectedRules) { dto.Rules.Add(new RuleModel { Id = ruleId, Namespace = "SqlCop.Rules" }); var item = homeModel.AllRules.SingleOrDefault(s => s.Id == ruleId); if (item != null) { item.Selected = true; } } } List <SqlCop.ServiceModel.RuleProblem> response = null; try { response = _client.Post(dto); } catch (WebServiceException ex) { homeModel.ErrorDescription = ex.ErrorMessage; } if (response != null && response.Any()) { homeModel.Problems = response; } else { homeModel.SuccessMessage = "No rule violations found"; } return(View(homeModel)); }
public ActionResult Index(Home model) { var homeModel = BuildModel(); homeModel.Sql = model.Sql; var dto = new CheckRules { Sql = model.Sql, Rules = new List<RuleModel>()}; if (model.SelectedRules != null) { foreach (string ruleId in model.SelectedRules) { dto.Rules.Add(new RuleModel { Id = ruleId, Namespace = "SqlCop.Rules" }); var item = homeModel.AllRules.SingleOrDefault(s => s.Id == ruleId); if (item != null) item.Selected = true; } } List<SqlCop.ServiceModel.RuleProblem> response = null; try { response = _client.Post(dto); } catch (WebServiceException ex) { homeModel.ErrorDescription = ex.ErrorMessage; } if (response != null && response.Any()) { homeModel.Problems = response; } else { homeModel.SuccessMessage = "No rule violations found"; } return View(homeModel); }
private bool CheckRulesForPosition(Board p_Board, int p_X, int p_Y) { CheckRulesForPositionCalled++; CheckRules?.Invoke(p_Board, p_X, p_Y); return(_Rules?.TrueForAll(r => r.CheckRuleForPosition(p_Board, p_X, p_Y)) ?? false); }
public void SetCheckRules(CheckRules checks) { _checks = checks; }