示例#1
0
        /// <summary>
        /// Add a Darwin via text rule
        /// </summary>
        /// <param name="rule">Via text rule</param>
        public void Add(ViaRule rule)
        {
            if (!this.Equals(rule.At))
            {
                throw new ArgumentException($"Via Rule is not for {this}: {rule}");
            }

            ViaTextRules.AddRule(rule);
        }
示例#2
0
        public void AddRule(ViaRule viaRule)
        {
            if (!_rules.TryGetValue(viaRule.Destination, out var destinationRules))
            {
                destinationRules = new List <ViaRule>();
                _rules.Add(viaRule.Destination, destinationRules);
            }

            // Want the rules with Location2 before those without so they get found first
            if (viaRule.HasLocation2)
            {
                destinationRules.Insert(0, viaRule);
            }
            else
            {
                destinationRules.Add(viaRule);
            }
        }