コード例 #1
0
        public string WizardOutput(NetLanguage leng)
        {
            StringBuilder sb = new StringBuilder(500);

            switch (leng)
            {
            case NetLanguage.VbNet:
                if (RecordKind == RecordKind.FixedLength)
                {
                    sb.AppendLine("<FixedLengthRecord()> _");
                }
                else
                {
                    sb.AppendLine("<DelimitedRecord(\"" + Delimiter + "\") >_");
                }

                if (IgnoreFirst > 0)
                {
                    sb.AppendLine("<IgnoreFirst(" + IgnoreFirst.ToString() + ")> _");
                }

                if (IgnoreLast > 0)
                {
                    sb.AppendLine("<IgnoreLast(" + IgnoreLast.ToString() + ")> _");
                }

                if (IgnoreEmptyLines)
                {
                    sb.AppendLine("<IgnoreEmptyLines()> _");
                }

                sb.Append(EnumHelper.GetVisibility(leng, mClassVisibility));

                if (mMarkAsSealed)
                {
                    sb.Append(" Not Inheritable");
                }

                sb.AppendLine(" Class " + this.mClassName);
                sb.AppendLine();
                break;

            case NetLanguage.CSharp:
                if (RecordKind == RecordKind.FixedLength)
                {
                    sb.AppendLine("[FixedLengthRecord()]");
                }
                else
                {
                    sb.AppendLine("[DelimitedRecord(\"" + Delimiter + "\")]");
                }

                if (IgnoreEmptyLines)
                {
                    sb.AppendLine("[IgnoreEmptyLines()]");
                }

                if (IgnoreFirst > 0)
                {
                    sb.AppendLine("[IgnoreFirst(" + IgnoreFirst.ToString() + ")]");
                }

                if (IgnoreLast > 0)
                {
                    sb.AppendLine("[IgnoreLast(" + IgnoreLast.ToString() + ")]");
                }

                sb.Append(EnumHelper.GetVisibility(leng, mClassVisibility));

                if (mMarkAsSealed)
                {
                    sb.Append(" sealed");
                }

                sb.AppendLine(" class " + this.mClassName);
                sb.AppendLine("{");
                break;

            default:
                break;
            }

            foreach (DesignFieldInfoBase info in mFields)
            {
                info.FillFieldDefinition(leng, sb, mUseProperties);

                if (mUseProperties)
                {
                    info.CreateProperty(leng, sb);
                }
            }

            // Append End

            switch (leng)
            {
            case NetLanguage.VbNet:
                sb.AppendLine("End Class");
                break;

            case NetLanguage.CSharp:
                sb.AppendLine("}");
                break;

            default:
                break;
            }


            return(sb.ToString());
        }