示例#1
0
        protected CodeWriter(CodeWriterOptions codeWriterOptions)
        {
            DeclarationSection      = new CodeSection();
            ConstructorsSection     = new CodeSection();
            PropertiesSection       = new CodeSection();
            PublicPropertiesSection = new CodeSection();
            MethodsSection          = new CodeSection();
            PublicMethodsSection    = new CodeSection();

            declarationSectionWriter      = new CodeSectionWriter(DeclarationSection, codeWriterOptions, this);
            constructorsSectionWriter     = new CodeSectionWriter(ConstructorsSection, codeWriterOptions, this);
            propertiesSectionWriter       = new CodeSectionWriter(PropertiesSection, codeWriterOptions, this);
            publicPropertiesSectionWriter = new CodeSectionWriter(PublicPropertiesSection, codeWriterOptions, this);
            methodsSectionWriter          = new CodeSectionWriter(MethodsSection, codeWriterOptions, this);
            publicMethodsSectionWriter    = new CodeSectionWriter(PublicMethodsSection, codeWriterOptions, this);
        }
示例#2
0
 private void WriteSection(CodeSection section, bool ignoreNewLineInSection)
 {
     if (section.Lines.Any())
     {
         AppendLineIfNeeded();
         foreach (var line in section.Lines)
         {
             if (string.IsNullOrEmpty(line))
             {
                 if (!ignoreNewLineInSection)
                 {
                     appendLine = true;
                 }
                 continue;
             }
             AppendLineIfNeeded();
             WriteIndentation();
             fileContent.AppendLine(line);
         }
         appendLine = true;
     }
 }
 public CodeSectionWriter(CodeSection codeSection, CodeWriterOptions codeWriterOptions, CodeWriter codeWriter)
 {
     this.codeSection       = codeSection;
     this.codeWriterOptions = codeWriterOptions;
     this.codeWriter        = codeWriter;
 }