Example #1
0
 public static string AttributeSyntax(AttributeSyntax attribute)
 {
     if (IsProtocolBuilderAttribute(attribute) || attribute.ToString().ToLower().Contains("nullable"))
     {
         return("");
     }
     return(Builder.Instance.LanguageConvertAttribute(attribute));
 }
Example #2
0
        public void GetChangeAttributeAction_Changes_Attribute_To_Specified_Value()
        {
            const string newAttributeName    = "NewAttribute";
            var          changeAttributeFunc = _attributeActions.GetChangeAttributeAction(newAttributeName);
            var          newNode             = changeAttributeFunc(_syntaxGenerator, _node);

            Assert.AreEqual(OriginalAttribute, _node.ToString());
            Assert.AreEqual(newAttributeName, newNode.ToString());
        }
Example #3
0
        private bool AttributeMatchesVersionClientBinding(AttributeSyntax attribute)
        {
            var attributeString = attribute.ToString();

            if (version == DurableVersion.V1 && string.Equals(attributeString, "OrchestrationClient"))
            {
                return(true);
            }

            if (version == DurableVersion.V2 && string.Equals(attributeString, "DurableClient"))
            {
                return(true);
            }

            return(false);
        }
Example #4
0
        public static string AttributeSyntax(AttributeSyntax attribute)
        {
            var output = "@" + SyntaxNode(attribute.Name).TrimEnd('!');

            if (IsProtocolBuilderAttribute(attribute) || attribute.ToString().ToLower().Contains("nullable"))
            {
                return("");
            }

            if (attribute.ArgumentList != null)
            {
                output += SyntaxNode(attribute.ArgumentList);
            }

            return(output);
        }
Example #5
0
        static string AttributeConnectionString(SemanticModel semanticModel, AttributeSyntax attributeSyntax)
        {
            var attributeFullName     = GetAttributeFullName(semanticModel, attributeSyntax);
            var attributeSyntaxString = attributeSyntax.ToString();
            var attributeParameterListStartPosition = attributeSyntaxString.IndexOf('(');

            if (attributeParameterListStartPosition == -1)
            {
                return(attributeFullName);
            }

            var attributeParameterList = attributeSyntaxString.Substring(attributeParameterListStartPosition)
                                         .Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)
                                         .Select(str => str.TrimStart())
                                         .ConcatToString(" ");

            return(attributeFullName + attributeParameterList);
        }
        //public override void VisitArrayRankSpecifier(ArrayRankSpecifierSyntax node)
        //{
        //    base.VisitArrayRankSpecifier(node);
        //}

        //public override void VisitArrayType(ArrayTypeSyntax node)
        //{
        //    base.VisitArrayType(node);
        //}

        //public override void VisitArrowExpressionClause(ArrowExpressionClauseSyntax node)
        //{
        //    base.VisitArrowExpressionClause(node);
        //}

        //public override void VisitAssignmentExpression(AssignmentExpressionSyntax node)
        //{
        //    base.VisitAssignmentExpression(node);
        //}

        public override void VisitAttribute(AttributeSyntax node)
        {
            Debug.Fail(node.ToString());
            base.VisitAttribute(node);
        }
        private static int MapiPropTypeFromSchemaSyntax(AttributeSyntax syntax, bool multiValued)
        {
            int num;

            if (syntax <= AttributeSyntax.Enumeration)
            {
                switch (syntax)
                {
                case AttributeSyntax.Boolean:
                    num = 11;
                    goto IL_BD;

                case AttributeSyntax.Integer:
                    break;

                case (AttributeSyntax)3:
                case (AttributeSyntax)5:
                case AttributeSyntax.ObjectIdentifier:
                    goto IL_A2;

                case AttributeSyntax.Sid:
                    goto IL_95;

                default:
                    if (syntax != AttributeSyntax.Enumeration)
                    {
                        goto IL_A2;
                    }
                    break;
                }
                num = 3;
                goto IL_BD;
            }
            switch (syntax)
            {
            case AttributeSyntax.Numeric:
            case AttributeSyntax.Printable:
            case AttributeSyntax.Teletex:
            case AttributeSyntax.IA5:
            case AttributeSyntax.CaseSensitive:
                break;

            case (AttributeSyntax)21:
            case (AttributeSyntax)25:
            case (AttributeSyntax)26:
                goto IL_A2;

            case AttributeSyntax.UTCTime:
            case AttributeSyntax.GeneralizedTime:
                num = 64;
                goto IL_BD;

            default:
                switch (syntax)
                {
                case AttributeSyntax.Unicode:
                    break;

                case AttributeSyntax.Interval:
                    num = 20;
                    goto IL_BD;

                case AttributeSyntax.NTSecDesc:
                    goto IL_95;

                default:
                    if (syntax != AttributeSyntax.AccessPoint)
                    {
                        goto IL_A2;
                    }
                    num = 30;
                    goto IL_BD;
                }
                break;
            }
            num = 31;
            goto IL_BD;
IL_95:
            num = 258;
            goto IL_BD;
IL_A2:
            throw new InvalidOperationException(DirectoryStrings.UnsupportedADSyntaxException(syntax.ToString()));
IL_BD:
            if (multiValued)
            {
                num |= 4096;
            }
            return(num);
        }