/// <summary> /// Gets the <see cref="IFileLayout">layout</see> relevant to this object. /// </summary> /// <param name="encoder">The <see cref="IFileParserEncoder">encoder</see> to use. If null, the default (EBCDIC 2 ASCII) is used.</param> /// <returns>A <see cref="IFileLayout">layout</see> matching this object's properties.</returns> public IFileLayout GetFileLayout(IFileParserEncoder encoder = null) { IFileParserEncoder defEncoder = encoder ?? FileParserEncoder.GetDefaultEncoder(); IFileLayout result = new FileLayout(defEncoder) { Name = Name, OpenAsText = OpenAsText, RecordLength = RecordLength }; if (OpenAsText) { result.FillCharacter = FillCharacter; result.TextLineTerminator = TextLineTerminator; } else { result.FillByte = FillByte; } if (HeaderFields != null && HeaderFields.Length > 0) { System.Collections.Generic.List <IFileField> fields = new System.Collections.Generic.List <IFileField>(); foreach (SerializableField field in HeaderFields.OrderBy(x => x.StartPosition)) { fields.Add(field.GetField(defEncoder)); } result.HeaderRecord = new FileRecord(fields.ToArray()); } if (FooterFields != null && FooterFields.Length > 0) { System.Collections.Generic.List <IFileField> fields = new System.Collections.Generic.List <IFileField>(); foreach (SerializableField field in FooterFields.OrderBy(x => x.StartPosition)) { fields.Add(field.GetField(defEncoder)); } result.FooterRecord = new FileRecord(fields.ToArray()); } if (MasterFields != null && MasterFields.Length > 0) { System.Collections.Generic.List <IFileField> fields = new System.Collections.Generic.List <IFileField>(); foreach (SerializableField field in MasterFields.OrderBy(x => x.StartPosition)) { fields.Add(field.GetField(defEncoder)); } result.MasterFields = fields.ToArray(); } return(result); }
/// <summary> /// Initializes a new instance of the <see cref="Footer" /> class. /// </summary> public Footer() : base(CLASS_NAME) { mFields = new FooterFields(this); }