public override bool ProcessLine(string line) { base.ProcessLine(); try { Rule Rule = new Rule(line); if (Rule.Enabled && Rule.Valid) { RulesL.Add(Rule); bool Found = false; foreach (var RuleKind in RuleKindsL) { if (RuleKind.Kind == Rule.RuleKind) { // rulekind already exists so add to rule list RuleKind.Add(Rule); Found = true; } } if (!Found) { RuleKind RuleK = new RuleKind(Rule); RuleKindsL.Add(RuleK); } } } catch (Exception Ex) { CheckThreadAbort(Ex); } return(true); }
public Rule(RuleKind kind, string propertyName, string target) { //CN: Check for stuff Kind = kind; PropertyName = propertyName; Target = target; }
public Rules(string filename, string cmfilename, string record, Type type, int offset) : base(filename, cmfilename, record, type, offset) { SolderMaskExpansion = new RuleKind(null); PasteMaskExpansion = new RuleKind(null); PlaneClearance = new RuleKind(null); PolygonConnect = new RuleKind(null); Clearance = new RuleKind(null); }
public ReferenceRule(string patternFrom, string patternTo, RuleKind kind, string description, bool?isPrivateAssetsAllSet = null, string version = null) { PatternFrom = patternFrom; PatternTo = patternTo; Kind = kind; Description = description; IsPrivateAssetsAllSet = isPrivateAssetsAllSet; Version = version; }
public Rule InvokeSubmission(RuleKind ruleKind) { Rule rule = new Rule(ruleKind, textBoxName.Text); TableUtility tableUtility = new TableUtility(); tableUtility.CreateTable(rule); tableUtility.InsertTableRow(rule); return(rule); }
private DropDownItem <RuleKind> GetDropDownItemFromRuleKind(RuleKind ruleKind) { Type enumType = typeof(RuleKind); DescriptionAttribute attribute = enumType.GetMember(ruleKind.ToString()).FirstOrDefault(x => x.DeclaringType == enumType).GetCustomAttribute <DescriptionAttribute>(); DropDownItem <RuleKind> item = new DropDownItem <RuleKind> { Value = ruleKind, Description = attribute.Description }; return(item); }
/// <summary> /// Добавляет к цели правило выбора географического округа /// </summary> /// <param name="target">Цель геолокации</param> /// <param name="area">Географический округ</param> /// <param name="kind">Вид правила включения</param> public void AddAreaToTarget(Target target, Area area, RuleKind kind) { AreaRule rule = AreaRuleRepository.FindByTargetAndArea(target, area); if (rule == null) { rule = new AreaRule() { TargetId = target.Id, AreaId = area.Id, Kind = kind }; AreaRuleRepository.Create(rule); } else if (rule.Kind != kind) { rule.Kind = kind; AreaRuleRepository.Save(rule); } }
/// <summary> /// Добавляет к цели правило выбора страны /// </summary> /// <param name="target">Цель геолокации</param> /// <param name="country">Двухсимвольный код страны</param> /// <param name="kind">Вид правила включения</param> public void AddCountryToTarget(Target target, string country, RuleKind kind) { CountryRule rule = CountryRuleRepository.FindByTargetAndCountry(target, country); if (rule == null) { rule = new CountryRule() { TargetId = target.Id, Country = country, Kind = kind }; CountryRuleRepository.Create(rule); } else if (rule.Kind != kind) { rule.Kind = kind; CountryRuleRepository.Save(rule); } }
/// <summary> /// Добавляет к цели правило выбора географической локации /// </summary> /// <param name="target">Цель геолокации</param> /// <param name="location">Географическая локация</param> /// <param name="kind">Вид правила включения</param> public void AddLocationToTarget(Target target, Location location, RuleKind kind) { LocationRule rule = LocationRuleRepository.FindByTargetAndLocation(target, location); if (rule == null) { rule = new LocationRule() { TargetId = target.Id, LocationId = location.Id, Kind = kind }; LocationRuleRepository.Create(rule); } else if (rule.Kind != kind) { rule.Kind = kind; LocationRuleRepository.Save(rule); } }
/// <summary> /// Добавляет к цели правило выбора географического региона /// </summary> /// <param name="target">Цель геолокации</param> /// <param name="region">Географический регион</param> /// <param name="kind">Вид правила включения</param> public void AddRegionToTarget(Target target, Region region, RuleKind kind) { RegionRule rule = RegionRuleRepository.FindByTargetAndRegion(target, region); if (rule == null) { rule = new RegionRule() { TargetId = target.Id, RegionId = region.Id, Kind = kind }; RegionRuleRepository.Create(rule); } else if (rule.Kind != kind) { rule.Kind = kind; RegionRuleRepository.Save(rule); } }
/// <summary> /// Implementation of <see cref="IRuleUserControl"/> /// </summary> /// <param name="ruleKind">Selected <see cref="RuleKind"/></param> /// <returns>Newly created rule, in that case an <see cref="AllowList"/></returns> public Rule InvokeSubmission(RuleKind ruleKind) { if (passedRule != null) { passedRule.Name = ruleName.Text; BindingList <Asset> changedAllowList = (BindingList <Asset>)FormUtility.GetBindingSource(dataGridView).List; passedRule.Allowed = changedAllowList.ToList(); return(passedRule); } AllowList newAllowList = new AllowList(RuleKind.RULE_EXCEPTION, ruleName.Text); foreach (DataGridViewRow row in dataGridView.Rows) { newAllowList.Allowed.Add(row.DataBoundItem as Asset); } TableUtility tableUtility = new TableUtility(); tableUtility.CreateTable(newAllowList); tableUtility.InsertTableRow(newAllowList); return(newAllowList); }
public Rule InvokeSubmission(RuleKind ruleKind) { if (passedRule != null) { passedRule.Name = ruleName.Text; BindingList <AssetKind> changedBanList = (BindingList <AssetKind>)FormUtility.GetBindingSource(dataGridView).List; passedRule.Banned = changedBanList.ToList(); return(passedRule); } BanList <AssetKind> newBanList = new BanList <AssetKind>(RuleKind.RESTRICTED_INSTRUMENT_TYPE, ruleName.Text); foreach (DataGridViewRow row in dataGridView.Rows) { newBanList.Banned.Add(row.DataBoundItem as AssetKind); } TableUtility tableUtility = new TableUtility(); tableUtility.CreateTable(newBanList); tableUtility.InsertTableRow(newBanList); return(newBanList); }
/// <summary> /// Implementation of <see cref="IRuleUserControl"/>. This method is called by the parent form /// for invoking the addition of a new rule. /// </summary> /// <param name="ruleKind"><see cref="RuleKind"/></param> /// <returns>New <see cref="Rule"/></returns> public Rule InvokeSubmission(RuleKind ruleKind) { bool parsingSuccessful = double.TryParse(textBoxValue.Text, out double value); if (!parsingSuccessful) { MessageBox.Show("Bitte eine gültige Zahl eingeben."); return(null); } if (passedRule != null) { passedRule.Name = textBoxDescription.Text; passedRule.NumericValue = value; return(passedRule); } TableUtility tableUtility = new TableUtility(); Rule newRule = new NumericRule(value, ruleKind, textBoxDescription.Text); tableUtility.CreateTable(newRule); tableUtility.InsertTableRow(newRule); return(newRule); }
public Rule InvokeSubmission(RuleKind ruleKind) { bool parsingSuccessfulRatingClass = double.TryParse(textBoxRatingClass.Text, out double ratingClass); bool parsingSuccessfulNumericValue = double.TryParse(textBoxNumericValue.Text, out double numericValue); if (!parsingSuccessfulNumericValue || !parsingSuccessfulRatingClass) { MessageBox.Show("Bitte eine gültige Zahl eingeben."); return(null); } if (passedRule != null) { passedRule.Name = textBoxName.Text; passedRule.MaxRatio = numericValue; passedRule.RatingClass = ratingClass; return(passedRule); } RatingQuoteRule newRatingQuoteRule = new RatingQuoteRule(ratingClass, numericValue, RuleKind.MAX_RATING_RATIO, textBoxName.Text); TableUtility tableUtility = new TableUtility(); tableUtility.CreateTable(newRatingQuoteRule); tableUtility.InsertTableRow(newRatingQuoteRule); return(newRatingQuoteRule); }
/// <summary> /// Добавляет к цели правило выбора географического округа /// </summary> /// <param name="targetId">Идентификатор цели геолокации</param> /// <param name="areaName">Название географического округа</param> /// <param name="kind">Вид правила включения</param> public void AddAreaToTarget(Guid targetId, string areaName, RuleKind kind) { AddAreaToTarget(FindTarget(targetId), FindArea(areaName), kind); }
private IEnumerable <ReferenceRule> GetMatchingRules(IReadOnlyList <ReferenceRule> rules, Reference reference, RuleKind kind) { foreach (var rule in rules) { if (Regex.IsMatch(reference.From, _patternParser.GetRegex(rule.PatternFrom)) && Regex.IsMatch(reference.To, _patternParser.GetRegex(rule.PatternTo)) && DoesPrivateAssetsRuleMatch(reference, rule) && DoesVersionRuleMatch(reference, rule) && rule.Kind == kind) { yield return(rule); } } }
/// <summary> /// Добавляет к цели правило выбора географической локации /// </summary> /// <param name="targetId">Идентификатор цели геолокации</param> /// <param name="locationName">Название географической локации</param> /// <param name="regionName">Название географического региона</param> /// <param name="areaName">Название географического округа</param> /// <param name="kind">Вид правила включения</param> public void AddLocationToTarget(Guid targetId, string locationName, string regionName, string areaName, RuleKind kind) { AddLocationToTarget(FindTarget(targetId), FindLocation(locationName, regionName, areaName), kind); }
public ParseNode(RuleKind ruleKind) { Rule = ruleKind; Children = new List<ParseNode>(); }
public AstTreeVisitorRule(ParseNode node, RuleKind rule) : base(node) { _rule = rule; }
public static bool NodeMatchesRule(this List<ParseNode> nodes, RuleKind ruleKind, int pos = 0) { return nodes[pos].NodeMatchesRule(ruleKind); }
/// <summary> /// Добавляет к цели правило выбора географического региона /// </summary> /// <param name="targetId">Идентификатор цели геолокации</param> /// <param name="regionName">Название географического региона</param> /// <param name="areaName">Название географического округа</param> /// <param name="kind">Вид правила включения</param> public void AddRegionToTarget(Guid targetId, string regionName, string areaName, RuleKind kind) { AddRegionToTarget(FindTarget(targetId), FindRegion(regionName, areaName), kind); }
private ReferenceRuleBuilder Is(RuleKind kind) { _kind = kind; return(this); }
protected SemanticFixForRule(RuleKind rule) { _rule = rule; }
/// <summary> /// Добавляет к цели правило выбора страны /// </summary> /// <param name="targetId">Идентификатор цели геолокации</param> /// <param name="country">Двухсимвольный код страны</param> /// <param name="kind">Вид правила включения</param> public void AddCountryToTarget(Guid targetId, string country, RuleKind kind) { AddCountryToTarget(FindTarget(targetId), country, kind); }
public static bool NodeMatchesRule(this ParseNode node, RuleKind ruleKind) { return node.Rule == ruleKind; }
public NumericRule(double numericValue, RuleKind ruleKind) : base(ruleKind) { NumericValue = numericValue; }
protected CodeGenForT(RuleKind rule) { _rule = rule; }
protected MultiPassParserByRule(RuleKind rule) { _rule = rule; }
public static int GetNextOfRule(this List<ParseNode> nodes, RuleKind ruleKind, int startPos = 0) { for (var i = startPos + 1; i < nodes.Count; i++) { var astNode = nodes[i]; if (astNode.Rule == ruleKind) return i; } return 0; }
public static int GetNextMachingTokenKind(this CleanupAstNodeStates cleanStates, RuleKind ruleKind, int startPos = 0) { return cleanStates.MappedNodes.GetNextOfRule(ruleKind); }
public EmtpyCodeGenForT(RuleKind rule) { _rule = rule; }