internal override void AddAttributesCode(AttributesBuilder attbs, NetLanguage lang)
        {
            if (mFieldLength <= 0)
                throw new BadUsageException("The Length of each field must be grater than 0");
            else
                attbs.AddAttribute("FieldFixedLength(" + mFieldLength.ToString() + ")");

            if (mAlignMode != AlignMode.Left)
            {
                if (lang == NetLanguage.CSharp)
                    attbs.AddAttribute("FieldAlign(AlignMode." + mAlignMode.ToString() + ", '" + mAlignChar.ToString() + "')");

                else if (lang == NetLanguage.VbNet)
                    attbs.AddAttribute("FieldAlign(AlignMode." + mAlignMode.ToString() + ", \"" + mAlignChar.ToString() + "\"c)");
            }
        }
        internal override void AddAttributesCode(AttributesBuilder attbs, NetLanguage leng)
        {
            if (mFieldQuoted)
            {
                if (leng == NetLanguage.CSharp)
                {
                    var quoteStr = mQuoteChar.ToString();
                    if (mQuoteChar == '\'') quoteStr = @"\'";

                    attbs.AddAttribute("FieldQuoted('" + quoteStr + "', QuoteMode." + mQuoteMode.ToString() + ", MultilineMode." + mQuoteMultiline.ToString() + ")");
                }
                else if (leng == NetLanguage.VbNet)
                {
                    var quoteStr = mQuoteChar.ToString();
                    if (mQuoteChar == '"') quoteStr = "\"\"";

                    attbs.AddAttribute("FieldQuoted(\"" + quoteStr + "\"c, QuoteMode." + mQuoteMode.ToString() + ", MultilineMode." + mQuoteMultiline.ToString() + ")");
                }
            }
        }
 internal override void AddAttributesCode(AttributesBuilder attbs, NetLanguage leng)
 {
     attbs.AddAttribute("FixedLengthRecord(FixedMode." + mFixedMode.ToString() + ")");
 }
        private void AddAttributesInternal(AttributesBuilder attbs, NetLanguage leng)
        {
            if (mFieldOptional)
                attbs.AddAttribute("FieldOptional()");

            if (mFieldIgnored)
                attbs.AddAttribute("FieldIgnored()");

            if (mFieldInNewLine)
                attbs.AddAttribute("FieldInNewLine()");


            if (mFieldNullValue != null)
            {
                if (mFieldNullValue is string)
                    attbs.AddAttribute("FieldNullValue(\"" + mFieldNullValue + "\")");
                else
                {
                    var t = mFieldNullValue.GetType().FullName;
                    var gt = string.Empty;
                    if (leng == NetLanguage.CSharp)
                        gt = "typeof(" + t + ")";
                    else if (leng == NetLanguage.VbNet)
                        gt = "GetType(" + t + ")";

                    attbs.AddAttribute("FieldNullValue(" + gt + ", \"" + mFieldNullValue + "\")");
                }
            }


            attbs.AddAttribute(mConverter.GetConverterCode(leng));

            if (mTrimMode != TrimMode.None)
            {
                if (" \t" == mTrimChars)
                    attbs.AddAttribute("FieldTrim(TrimMode." + mTrimMode.ToString() + ")");
                else
                    attbs.AddAttribute("FieldTrim(TrimMode." + mTrimMode.ToString() + ", \"" + mTrimChars + "\")");
            }
        }
 internal abstract void AddAttributesCode(AttributesBuilder attbs, NetLanguage leng);
        internal string GetFieldCode(NetLanguage lang)
        {
            var sb = new StringBuilder(100);

            var attbs = new AttributesBuilder(lang);

            AddAttributesInternal(attbs, lang);
            AddAttributesCode(attbs, lang);

            sb.Append(attbs.GetAttributesCode());

            var visi = mVisibility;
            var currentName = mFieldName;

            if (mClassBuilder.GenerateProperties)
            {
                visi = NetVisibility.Private;
                currentName = "m" + mFieldName;
            }

            switch (lang)
            {
                case NetLanguage.VbNet:
                    sb.Append(ClassBuilder.GetVisibility(lang, visi) + currentName + " As " + mFieldType);
                    break;
                case NetLanguage.CSharp:
                    sb.Append(ClassBuilder.GetVisibility(lang, visi) + mFieldType + " " + currentName + ";");
                    break;
                default:
                    break;
            }

            sb.Append(StringHelper.NewLine);

            if (mClassBuilder.GenerateProperties)
            {
                sb.Append(StringHelper.NewLine);

                switch (lang)
                {
                    case NetLanguage.VbNet:
                        sb.Append("Public Property " + mFieldName + " As " + mFieldType);
                        sb.Append(StringHelper.NewLine);
                        sb.Append("   Get");
                        sb.Append(StringHelper.NewLine);
                        sb.Append("      Return m" + mFieldName);
                        sb.Append(StringHelper.NewLine);
                        sb.Append("   End Get");
                        sb.Append(StringHelper.NewLine);
                        sb.Append("   Set (value As " + mFieldType + ")");
                        sb.Append(StringHelper.NewLine);
                        sb.Append("      m" + mFieldName + " = value");
                        sb.Append(StringHelper.NewLine);
                        sb.Append("   End Set");
                        sb.Append(StringHelper.NewLine);
                        sb.Append("End Property");
                        break;
                    case NetLanguage.CSharp:
                        sb.Append("public " + mFieldType + " " + mFieldName);
                        sb.Append(StringHelper.NewLine);
                        sb.Append("{");
                        sb.Append(StringHelper.NewLine);
                        sb.Append("   get { return m" + mFieldName + "; }");
                        sb.Append(StringHelper.NewLine);
                        sb.Append("   set { m" + mFieldName + " = value; }");
                        sb.Append(StringHelper.NewLine);
                        sb.Append("}");
                        break;
                    default:
                        break;
                }

                sb.Append(StringHelper.NewLine);
                sb.Append(StringHelper.NewLine);
            }

            return sb.ToString();
        }
 internal override void AddAttributesCode(AttributesBuilder attbs, NetLanguage leng)
 {
     if (mDelimiter == string.Empty)
         throw new BadUsageException("The Delimiter of the DelimiterClassBuilder can't be null or empty.");
     else
         attbs.AddAttribute("DelimitedRecord(\"" + mDelimiter + "\")");
 }
        private void AddAttributesInternal(AttributesBuilder attbs, NetLanguage lang)
        {
            if (mIgnoreFirstLines != 0)
                attbs.AddAttribute("IgnoreFirst(" + mIgnoreFirstLines.ToString() + ")");

            if (mIgnoreLastLines != 0)
                attbs.AddAttribute("IgnoreLast(" + mIgnoreLastLines.ToString() + ")");

            if (mIgnoreEmptyLines)
                attbs.AddAttribute("IgnoreEmptyLines()");

            if (mRecordConditionInfo.Condition != Enums.RecordCondition.None)
                attbs.AddAttribute("ConditionalRecord(RecordCondition." + mRecordConditionInfo.Condition.ToString() + ", \"" + mRecordConditionInfo.Selector + "\")");

            if (mIgnoreCommentInfo.CommentMarker != null && mIgnoreCommentInfo.CommentMarker.Length > 0)
                attbs.AddAttribute("IgnoreCommentedLines(\"" + mIgnoreCommentInfo.CommentMarker + "\", " + mIgnoreCommentInfo.InAnyPlace.ToString().ToLower() + ")");
        }
        /// <summary>
        ///     Returns the source code for the current class in the specified language.
        /// </summary>
        /// <param name="lang">The language for the return code.</param>
        /// <returns>The Source Code for the class that are currently building.</returns>
        public string GetClassSourceCode(NetLanguage lang)
        {
            var sb = new StringBuilder(100);

            BeginNamespace(lang, sb);

            var attbs = new AttributesBuilder(lang);

            AddAttributesInternal(attbs, lang);
            AddAttributesCode(attbs, lang);

            sb.Append(attbs.GetAttributesCode());

            switch (lang)
            {
                case NetLanguage.VbNet:
                    sb.Append(GetVisibility(lang, mVisibility) + GetSealed(lang) + "Class " + mClassName);
                    sb.Append(StringHelper.NewLine);
                    break;
                case NetLanguage.CSharp:
                    sb.Append(GetVisibility(lang, mVisibility) + GetSealed(lang) + "class " + mClassName);
                    sb.Append(StringHelper.NewLine);
                    sb.Append("{");
                    break;
            }

            sb.Append(StringHelper.NewLine);
            sb.Append(StringHelper.NewLine);

            foreach (FieldBuilder field in mFields)
            {
                sb.Append(field.GetFieldCode(lang));
                sb.Append(StringHelper.NewLine);
            }


            sb.Append(StringHelper.NewLine);

            switch (lang)
            {
                case NetLanguage.VbNet:
                    sb.Append("End Class");
                    break;
                case NetLanguage.CSharp:
                    sb.Append("}");
                    break;
            }

            EndNamespace(lang, sb);

            return sb.ToString();
        }