Exemple #1
0
        public override SelectionRuleNode CreateNode([NotNull] Node node, params object[] parameters)
        {
            SelectionRuleNode result = null;

            if (parameters != null && parameters.Length == 1 && parameters[0] is bool boolValue)
            {
                result = new CrossTrustBoundaryRuleNode(node.Text, boolValue)
                {
                    Scope = Scope
                };
            }

            return(result);
        }
Exemple #2
0
        public override SelectionRuleNode VisitFlowExpression(TmtParser.FlowExpressionContext context)
        {
            SelectionRuleNode result = null;

            var id = context.right?.Text?.Trim('\'');

            if (!string.IsNullOrWhiteSpace(id))
            {
                switch (context.op?.GetText())
                {
                case "is":
                    result = GetIdComparisonRuleNode(id, Scope.Object);
                    break;

                case "crosses":
                    var template = GetTrustBoundaryTemplate(id);
                    if (template != null)
                    {
                        result = new TrustBoundaryTemplateRuleNode(template);
                    }
                    else
                    {
                        if (_source.ElementTypes?.Any(x => x.IsGeneric &&
                                                      (x.ElementType == ElementType.BorderBoundary || x.ElementType == ElementType.LineBoundary) &&
                                                      string.CompareOrdinal(x.TypeId, id) == 0) ?? false)
                        {
                            result = new CrossTrustBoundaryRuleNode("Crosses Trust Boundary", true);
                        }
                    }
                    break;
                }

                if (Rule == null)
                {
                    Rule = result;
                }
            }

            return(result);
        }
Exemple #3
0
 private static void UpdateNode([NotNull] Node node, [NotNull] CrossTrustBoundaryRuleNode ruleNode)
 {
     UpdateNode(node, ruleNode.Name, null, null, ruleNode.Value);
 }