Ejemplo n.º 1
0
        public static string GenerateCSharp(BaseSyntax ast, int tabSize = 4, string @namespace = null)
        {
            var options = new ApexSharpParserOptions {
                TabSize = tabSize
            };

            if (!string.IsNullOrWhiteSpace(@namespace))
            {
                options.Namespace = @namespace;
            }

            return(GenerateCSharp(ast, options));
        }
Ejemplo n.º 2
0
        public static string GenerateCSharp(BaseSyntax ast, ApexSharpParserOptions options)
        {
            // set default options
            options = options ?? new ApexSharpParserOptions();

            var generator = new CSharpCodeGenerator
            {
                IndentSize = options.TabSize,
                Namespace  = options.Namespace,
                UseLocalSObjectsNamespace = options.UseLocalSObjectsNamespace,
            };

            ast.Accept(generator);
            return(generator.Code.ToString());
        }
Ejemplo n.º 3
0
 // Convert Apex Code to C# with custom options
 public static string ConvertToCSharp(string apexCode, ApexSharpParserOptions options)
 {
     return(ApexSharpParser.GetApexAst(apexCode).ToCSharp(options));
 }
Ejemplo n.º 4
0
 public static string ToCSharp(this BaseSyntax node, ApexSharpParserOptions options) =>
 CSharpCodeGenerator.GenerateCSharp(node, options);