/// <summary> /// Creates anew SerializerField that wraps up the necessary information for serializing/deserializing an object /// </summary> /// <param name="config">Config information pulled from the CustomAttribute, FixedFieldAttribute</param> /// <param name="prop">PropertyInfo representing the property on the object</param> /// <param name="converter">Custom serializer specified for teh property</param> public SerializerField(FixedFieldAttribute config, PropertyInfo prop, Type converter) { this.Position = config.Position; this.Width = config.Width; this.Padder = config.Padder; this.Alignment = config.Alignment; this.OverflowMode = config.OverflowMode; this.Property = new FastProperty(prop); this.Converter = converter; this.IsComplexType = prop.PropertyType.IsComplexType(); }
/// <summary> /// Creates a new FixedFieldAttribute /// </summary> /// <param name="position">Order of field in fixed field row</param> /// <param name="width">Number of characters that field should occupy in string</param> /// <param name="padder">Character used when padding value of field</param> /// <param name="alignment">The alignment of the value, IE: should it to the right or left of its padding; default is Right</param> /// <param name="overflowMode">How should a value which overflows the width of the field be handled; default is NoOverflow</param> public FixedFieldAttribute( int position, int width = 0, char padder = '0', FixedFieldAlignment alignment = FixedFieldAlignment.Right, FixedFieldOverflowMode overflowMode = FixedFieldOverflowMode.NoOverflow) { this.Position = position; this.Width = width; this.Padder = padder; this.Alignment = alignment; this.OverflowMode = overflowMode; }