示例#1
0
        public override void WriteTo(CodeWriter codeWriter, CodeWriterOptions options)
        {
            if (functionDefinition.Name is null)
            {
                return;
            }

            codeWriter.WriteUsingStatement(UsingNamespaces);

            var methodNamePrefix = functionDefinition.Type == ObjectType.PropertyGetterFunction ? "Get" : string.Empty;

            codeWriter.PublicMethods
            .WriteWithConverter(new CommentSummaryCodeConverter(functionDefinition.Description))
            .WriteWithConverters(ParameterDefinitions.Select(parameterDefinition => new CommentParamCodeSectionConverter(parameterDefinition.Name, parameterDefinition.Description)))
            .WriteWithConverter(ReturnDefinition is not null ? new CommentReturnsCodeConverter(ReturnDefinition.Description) : null)
            .WriteWithConverter(functionDefinition.IsDeprecated ? new AttributeObsoleteCodeConverter(functionDefinition.Deprecated) : null)
            .WriteLine($"{MethodReturnType} {methodNamePrefix}{functionDefinition.Name.ToCapitalCase()}({MethodArguments});");
        }
示例#2
0
        public override void WriteTo(CodeWriter codeWriter, CodeWriterOptions options)
        {
            if (functionDefinition.Name is null)
            {
                return;
            }

            if (functionDefinition.Name is null)
            {
                return;
            }

            codeWriter.WriteUsingStatement(UsingNamespaces);

            codeWriter.PublicMethods
            .WriteWithConverter(new CommentSummaryCodeConverter(functionDefinition.Description))
            .WriteWithConverters(ParameterDefinitions.Select(parameterDefinition => new CommentParamCodeSectionConverter(parameterDefinition.Name, parameterDefinition.Description)))
            .WriteWithConverter(ReturnDefinition is not null ? new CommentReturnsCodeConverter(ReturnDefinition.Description) : null)
            .WriteWithConverter(functionDefinition.IsDeprecated ? new AttributeObsoleteCodeConverter(functionDefinition.Deprecated) : null)
            .WriteLine($"public virtual {MethodReturnType} {functionDefinition.Name.ToCapitalCase()}({MethodArguments})")
            .WriteStartBlock()
            .WriteLine($"return {ClientMethodInvoke}(\"{functionDefinition.Name}\"{ClientMethodInvokeArguments});")
            .WriteEndBlock();
        }