Exemple #1
0
        public ClassGenerator(string name, ClassAccessModifier access, StreamWriter writer)
        {
            Name               = name;
            AccessModifier     = access;
            _writer            = writer;
            TabSpaces          = 4;
            RenderRegionBounds = false;
            Modifiers          = ClassModifiers.None;

            Usings              = new UsingsRegion(this);
            Namespace           = new NameSpaceRegion(this);
            Attributes          = new AttributesRegion(this);
            Declaration         = new DeclarationRegion(this);
            PrivateFieldsRegion = new PrivateFieldsRegion(this);
            Ctor           = new CtorRegion(this);
            PropertyRegion = new PropertiesRegion(this);
            Methods        = new MethodsRegion(this);
        }
Exemple #2
0
        public void Render()
        {
            _writer.BaseStream.SetLength(0);
            _writer.BaseStream.Position = 0;

            Usings.RenderStart(_writer);
            Usings.RenderCode(_writer);
            Usings.RenderEnd(_writer);

            Namespace.RenderStart(_writer);
            Namespace.RenderCode(_writer);

            Attributes.RenderStart(_writer);
            Attributes.RenderCode(_writer);
            Attributes.RenderEnd(_writer);

            Declaration.RenderStart(_writer);
            Declaration.RenderCode(_writer);

            PrivateFieldsRegion.RenderStart(_writer);
            PrivateFieldsRegion.RenderCode(_writer);
            PrivateFieldsRegion.RenderEnd(_writer);

            Ctor.RenderStart(_writer);
            Ctor.RenderCode(_writer);
            Ctor.RenderEnd(_writer);

            PropertyRegion.RenderStart(_writer);
            PropertyRegion.RenderCode(_writer);
            PropertyRegion.RenderEnd(_writer);

            Methods.RenderStart(_writer);
            Methods.RenderCode(_writer);
            Methods.RenderEnd(_writer);

            Declaration.RenderEnd(_writer);

            Namespace.RenderEnd(_writer);

            _writer.Flush();
        }