Ejemplo n.º 1
0
 /// <summary>
 /// .ctor. Must be inherited.
 /// </summary>
 /// <param name="encoder">The <see cref="IFileParserEncoder">IFileParserEncoder</see> instance to use for encoding.</param>
 /// <param name="type">The <see cref="System.Type">type</see> of data the field contains.</param>
 /// <param name="name">The <see cref="System.String">name</see> of the field.</param>
 /// <param name="startPosition">The starting position of this field in the <see cref="IFileRecord">record</see> expressed as an
 /// <see cref="System.UInt32">unsigned integer</see>.</param>
 /// <param name="length">The field length expressed as an <see cref="System.UInt32">unsigned integer</see>.</param>
 /// <param name="format">The <see cref="FileFieldDataFormat">format</see> of the field.</param>
 public FileFieldBase(IFileParserEncoder encoder, Type type, string name, uint startPosition, uint length, FileFieldDataFormat format)
 {
     Encoder       = encoder;
     Type          = type;
     Name          = name;
     StartPosition = startPosition;
     Length        = length;
     DataFormat    = format;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// .ctor. Creates a new instance of FileField.
 /// </summary>
 /// <param name="encoder">The <see cref="IFileParserEncoder">IFileParserEncoder</see> instance to use for encoding.</param>
 /// <param name="type">The <see cref="System.Type">type</see> of data the field contains.</param>
 /// <param name="name">The <see cref="System.String">name</see> of the field.</param>
 /// <param name="startPosition">The starting position of this field in the <see cref="IFileRecord">record</see>
 /// expressed as an <see cref="System.UInt32">unsigned integer</see>.</param>
 /// <param name="length">The field length expressed as an <see cref="System.UInt32">unsigned integer</see>.</param>
 /// <param name="format">The <see cref="FileFieldDataFormat">format</see> of the field.</param>
 public FileField(IFileParserEncoder encoder, Type type, string name, uint startPosition, uint length, FileFieldDataFormat format)
 {
     if (format == FileFieldDataFormat.Table)
     {
         throw new InvalidOperationException($"{IO.FileParser.Properties.Resources.ResourceManager.GetString("UnsupportedType")} : {format}");
     }
     Encoder       = encoder;
     Type          = type;
     Name          = name;
     StartPosition = startPosition;
     Length        = length;
     DataFormat    = format;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// .ctor. Creates a new instance of FileField. Used for <see cref="System.DateTime">Date</see> <see cref="System.Type">types</see>.
 /// </summary>
 /// <param name="encoder">The <see cref="IFileParserEncoder">IFileParserEncoder</see> instance to use for encoding.</param>
 /// <param name="name">The <see cref="System.String">name</see> of the field.</param>
 /// <param name="startPosition">The starting position of this field in the <see cref="IFileRecord">record</see>
 /// expressed as an <see cref="System.UInt32">unsigned integer</see>.</param>
 /// <param name="length">The field length expressed as an <see cref="System.UInt32">unsigned integer</see>.</param>
 /// <param name="format">The <see cref="FileFieldDataFormat">format</see> of the field.</param>
 /// <param name="yearFirst">If <see cref="System.Boolean">true</see> it assumes the year is the first part of the string.
 /// Default is <see cref="System.Boolean">false</see>.
 /// Note: If the <see cref="System.String">string</see> contains a parsable date character ( / or - ) it will attempt to use
 /// <see cref="System.DateTime.TryParse(string, out System.DateTime)">TryParse</see> and return any successful result.
 /// If <see cref="System.DateTime.TryParse(string, out System.DateTime)">TryParse</see> fails it proceeds on to
 /// <see cref="System.String">string</see> parsing.
 /// </param>
 /// <param name="required">If <see cref="System.Boolean">true</see>, throw a <see cref="FieldException"></see> on a null result.</param>
 public FileField(IFileParserEncoder encoder, string name, uint startPosition, uint length, FileFieldDataFormat format,
                  bool yearFirst, bool required = false)
     : base(encoder, name, startPosition, length, format, yearFirst, required)
 {
 }
Ejemplo n.º 4
0
 /// <summary>
 /// .ctor. Must be inherited. Used for <see cref="System.DateTime">Date</see> <see cref="System.Type">types</see>.
 /// </summary>
 /// <param name="encoder">The <see cref="IFileParserEncoder">IFileParserEncoder</see> instance to use for encoding.</param>
 /// <param name="name">The <see cref="System.String">name</see> of the field.</param>
 /// <param name="startPosition">The starting position of this field in the <see cref="IFileRecord">record</see> expressed as an
 /// <see cref="System.UInt32">unsigned integer</see>.</param>
 /// <param name="length">The field length expressed as an <see cref="System.UInt32">unsigned integer</see>.</param>
 /// <param name="format">The <see cref="FileFieldDataFormat">format</see> of the field.</param>
 /// <param name="yearFirst">If <see cref="System.Boolean">true</see> it assumes the year is the first part of the string. Default is
 /// <see cref="System.Boolean">false</see>.
 /// Note: If the <see cref="System.String">string</see> contains a parsable date character ( / or - ) it will attempt to use
 /// <see cref="System.DateTime.TryParse(string, out System.DateTime)">TryParse</see> and return any successful result.
 /// If <see cref="System.DateTime.TryParse(string, out System.DateTime)">TryParse</see> fails it proceeds on to
 /// <see cref="System.String">string</see> parsing.
 /// </param>
 /// <param name="required">If <see cref="System.Boolean">true</see>, throw a <see cref="FieldException"></see> on a null result.</param>
 public FileFieldBase(IFileParserEncoder encoder, string name, uint startPosition, uint length, FileFieldDataFormat format,
                      bool yearFirst, bool required = false)
     : this(encoder, required ? typeof(DateTime) : typeof(DateTime?), name, startPosition, length, format)
 {
     YearFirst = yearFirst;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// .ctor. Must be inherited. Used for numeric <see cref="System.Decimal">(decimal)</see> <see cref="System.Type">types</see>.
 /// </summary>
 /// <param name="encoder">The <see cref="IFileParserEncoder">IFileParserEncoder</see> instance to use for encoding.</param>
 /// <param name="name">The <see cref="System.String">name</see> of the field.</param>
 /// <param name="startPosition">The starting position of this field in the <see cref="IFileRecord">record</see> expressed as an
 /// <see cref="System.UInt32">unsigned integer</see>.</param>
 /// <param name="length">The field length expressed as an <see cref="System.UInt32">unsigned integer</see>.</param>
 /// <param name="format">The <see cref="FileFieldDataFormat">format</see> of the field.</param>
 /// <param name="precision">The precision of the expected resultant as <see cref="System.Int16"/>short. Default is 0.
 /// The limitation is from logical reasons.</param>
 /// <param name="required">If <see cref="System.Boolean">true</see>, throw a <see cref="FieldException"></see> on a null result.</param>
 public FileFieldBase(IFileParserEncoder encoder, string name, uint startPosition, uint length, FileFieldDataFormat format,
                      short precision, bool required = false)
     : this(encoder, required ? typeof(decimal) : typeof(decimal?), name, startPosition, length, format)
 {
     Precision = precision;
 }