Released under a MIT license - https://opensource.org/licenses/MIT
FixedWidth is an easy to use .NET library for working with fixed width (flat formatted) text files. By applying attributes to your code, you can setup the position and format for your data when deserializing/serializing to and from fixed width files.
Available on Wiki.
BooleanFormatter
)ITextFormatter
[TextSerializable]
public class Dog
{
[TextField(1, 10)]
public string Name { get; set; }
[TextField(11, 1)]
public char Sex { get; set; }
[TextField(12, 3,
Padding = '0',
Alignment = TextAlignment.Right)]
public int Weight { get; set; }
[TextField(15, 8,
FormatterType = typeof(DateFormatter))]
public DateTime BirthDate { get; set; }
[TextField(23, 1,
FormatterType = typeof(BooleanFormatter))]
public bool SpayedNeutered { get; set; }
}
TextSerializer
instancevar serializer = new TextSerializer<Dog>();
var deserialized = serializer.Deserialize("Wally M065201011161");
BirthDate [DateTime]:{11/16/2010 12:00:00 AM}
Name [string]:"Wally"
Sex [char]:77 'M'
SpayedNeutered [bool]:true
Weight [int]:65
var serialized = serializer.Serialize(deserialized);
"Wally M065201011161"