private void WriteCodeFile(CodeFileWriter codeFileWriter)
        {
            codeFileWriter.WriteUsingStatements();
            codeFileWriter.WriteNamespace(CodeFile.Namespace);

            // start namespace block
            codeFileWriter.WriteStartBlock();
            codeFileWriter.Declaration.WriteLine(CodeFile.Declaration);
            codeFileWriter.WriteDeclarationSection();

            // start declaration block
            codeFileWriter.WriteStartBlock();

            codeFileWriter.WritePropertiesSection(ignoreNewLineInSection: true);
            codeFileWriter.WriteConstructorsSection();
            codeFileWriter.WritePublicPropertiesSection();
            codeFileWriter.WritePublicMethodsSection();
            codeFileWriter.WriteMethodsSection();

            // end declaration block
            codeFileWriter.WriteEndBlock();

            // end namespace block
            codeFileWriter.WriteEndBlock();
        }
Пример #2
0
        private void WriteCodeFile(CodeFileWriter codeFileWriter, CodeWriterOptions options)
        {
            codeFileWriter.WriteUsingStatements();

            if (string.IsNullOrEmpty(CodeFile.RelativeNamespace))
            {
                codeFileWriter.WriteNamespace($"{options.RootNamespace}");
            }
            else
            {
                codeFileWriter.WriteNamespace($"{options.RootNamespace}.{CodeFile.RelativeNamespace}");
            }

            // start namespace block
            codeFileWriter.WriteStartBlock();
            codeFileWriter.Declaration.WriteLine(CodeFile.Declaration);
            codeFileWriter.WriteDeclarationSection();

            // start declaration block
            codeFileWriter.WriteStartBlock();

            codeFileWriter.WritePropertiesSection(ignoreNewLineInSection: true);
            codeFileWriter.WriteConstructorsSection();
            codeFileWriter.WritePublicPropertiesSection();
            codeFileWriter.WritePublicMethodsSection();
            codeFileWriter.WriteMethodsSection();

            // end declaration block
            codeFileWriter.WriteEndBlock();

            // end namespace block
            codeFileWriter.WriteEndBlock();
        }