Merge() public method

public Merge ( ) : void
return void
Exemplo n.º 1
0
        public void Generate(String prefix, XDocument document, TextWriter writer)
        {
            XElement root = document.Element("dictionary");

            if (root == null)
            {
                return;
            }

            dictionary dictionary = new dictionary(root);

            IEnumerable <@class>         classes         = dictionary.suite.SelectMany(suite => suite.@class);
            IEnumerable <classextension> classExtensions = dictionary.suite.SelectMany(suite => suite.classextension);
            IEnumerable <command>        commands        = dictionary.suite.SelectMany(suite => suite.command);
            IEnumerable <enumeration>    enumerations    = dictionary.suite.SelectMany(suite => suite.enumeration);
            GenerationContext            context         = new GenerationContext(prefix, classes, classExtensions, commands, enumerations);

            context.Merge();

            // Create the compilation unit
            CodeCompileUnit compileUnit = this.Generate(context);

            // Write the result
            using (IndentedTextWriter tw = new IndentedTextWriter(writer))
            {
                CodeGeneratorOptions options = new CodeGeneratorOptions();
                options.BlankLinesBetweenMembers = true;
                options.BracingStyle             = "C";
                options.IndentString             = " ";
                options.VerbatimOrder            = true;
                this.provider.GenerateCodeFromCompileUnit(compileUnit, tw, new CodeGeneratorOptions());
            }
        }
Exemplo n.º 2
0
        public void Generate(String prefix, XDocument document, TextWriter writer)
        {
            XElement root = document.Element("dictionary");
            if (root == null)
            {
                return;
            }

            dictionary dictionary = new dictionary(root);

            IEnumerable<@class> classes = dictionary.suite.SelectMany(suite => suite.@class);
            IEnumerable<classextension> classExtensions = dictionary.suite.SelectMany(suite => suite.classextension);
            IEnumerable<command> commands = dictionary.suite.SelectMany(suite => suite.command);
            IEnumerable<enumeration> enumerations = dictionary.suite.SelectMany(suite => suite.enumeration);
            GenerationContext context = new GenerationContext(prefix, classes, classExtensions, commands, enumerations);
            context.Merge();

            // Create the compilation unit
            CodeCompileUnit compileUnit = this.Generate(context);

            // Write the result
            using (IndentedTextWriter tw = new IndentedTextWriter(writer))
            {
                CodeGeneratorOptions options = new CodeGeneratorOptions();
                options.BlankLinesBetweenMembers = true;
                options.BracingStyle = "C";
                options.IndentString = " ";
                options.VerbatimOrder = true;
                this.provider.GenerateCodeFromCompileUnit(compileUnit, tw, new CodeGeneratorOptions());
            }
        }