コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: Rule.cs プロジェクト: wareismymind/Parsimony
 public Rule(RuleKind kind, string propertyName, string target)
 {
     //CN: Check for stuff
     Kind         = kind;
     PropertyName = propertyName;
     Target       = target;
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 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;
 }
コード例 #5
0
        public Rule InvokeSubmission(RuleKind ruleKind)
        {
            Rule         rule         = new Rule(ruleKind, textBoxName.Text);
            TableUtility tableUtility = new TableUtility();

            tableUtility.CreateTable(rule);
            tableUtility.InsertTableRow(rule);
            return(rule);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        /// <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);
            }
        }
コード例 #8
0
        /// <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);
            }
        }
コード例 #9
0
        /// <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);
            }
        }
コード例 #10
0
        /// <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);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
 /// <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);
 }
コード例 #16
0
 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);
         }
     }
 }
コード例 #17
0
 /// <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);
 }
コード例 #18
0
ファイル: ParseNode.cs プロジェクト: ifzz/FDK
 public ParseNode(RuleKind ruleKind)
 {
     Rule = ruleKind;
     Children = new List<ParseNode>();
 }
コード例 #19
0
ファイル: AstTreeVisitorRule.cs プロジェクト: ifzz/FDK
 public AstTreeVisitorRule(ParseNode node, RuleKind rule)
     : base(node)
 {
     _rule = rule;
 }
コード例 #20
0
ファイル: AstNodeUtils.cs プロジェクト: ifzz/FDK
 public static bool NodeMatchesRule(this List<ParseNode> nodes, RuleKind ruleKind, int pos = 0)
 {
     return nodes[pos].NodeMatchesRule(ruleKind);
 }
コード例 #21
0
ファイル: TargetService.cs プロジェクト: romvs/IpGeoBase
 /// <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);
 }
コード例 #22
0
ファイル: TargetService.cs プロジェクト: romvs/IpGeoBase
        /// <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);
            }
        }
コード例 #23
0
ファイル: TargetService.cs プロジェクト: romvs/IpGeoBase
        /// <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);
            }
        }
コード例 #24
0
ファイル: TargetService.cs プロジェクト: romvs/IpGeoBase
        /// <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);
            }
        }
コード例 #25
0
 private ReferenceRuleBuilder Is(RuleKind kind)
 {
     _kind = kind;
     return(this);
 }
コード例 #26
0
ファイル: TargetService.cs プロジェクト: romvs/IpGeoBase
 /// <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);
 }
コード例 #27
0
ファイル: SemanticFixForRule.cs プロジェクト: ifzz/FDK
 protected SemanticFixForRule(RuleKind rule)
 {
     _rule = rule;
 }
コード例 #28
0
ファイル: TargetService.cs プロジェクト: romvs/IpGeoBase
 /// <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);
 }
コード例 #29
0
ファイル: AstNodeUtils.cs プロジェクト: ifzz/FDK
 public static bool NodeMatchesRule(this ParseNode node, RuleKind ruleKind)
 {
     return node.Rule == ruleKind;
 }
コード例 #30
0
ファイル: TargetService.cs プロジェクト: romvs/IpGeoBase
        /// <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);
            }
        }
コード例 #31
0
 public NumericRule(double numericValue, RuleKind ruleKind) : base(ruleKind)
 {
     NumericValue = numericValue;
 }
コード例 #32
0
ファイル: CodeGenForT.cs プロジェクト: ifzz/FDK
 protected CodeGenForT(RuleKind rule)
 {
     _rule = rule;
 }
コード例 #33
0
ファイル: MultiPassParserByRule.cs プロジェクト: ifzz/FDK
 protected MultiPassParserByRule(RuleKind rule)
 {
     _rule = rule;
 }
コード例 #34
0
ファイル: AstNodeUtils.cs プロジェクト: ifzz/FDK
 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;
 }
コード例 #35
0
ファイル: AstNodeUtils.cs プロジェクト: ifzz/FDK
 public static int GetNextMachingTokenKind(this CleanupAstNodeStates cleanStates, RuleKind ruleKind,
                                           int startPos = 0)
 {
     return cleanStates.MappedNodes.GetNextOfRule(ruleKind);
 }
コード例 #36
0
ファイル: EmtpyCodeGenForT.cs プロジェクト: ifzz/FDK
 public EmtpyCodeGenForT(RuleKind rule)
 {
     _rule = rule;
 }
コード例 #37
0
 /// <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);
 }