/// <summary> /// /// </summary> /// <param name="reader"></param> /// <returns></returns> private ISOFieldPackager LoadISOFieldPackager(XmlReader reader) { ISOFieldDefinition fieldDefinition = new ISOFieldDefinition(); ISOFieldPackager fieldPackager = new ISOFieldPackager(_logger); // Search for the attribute name on this current node. string attribute = reader["number"]; if (attribute != null) { fieldPackager.SetFieldNumber(Int32.Parse(attribute)); } attribute = reader["name"]; if (attribute != null) { fieldDefinition.name = attribute; } attribute = reader["length"]; if (attribute != null) { fieldDefinition.length = Int32.Parse(attribute); } attribute = reader["lengthlength"]; if (attribute != null) { fieldDefinition.lengthLength = Int32.Parse(attribute); } attribute = reader["lengthformat"]; if (attribute != null) { switch (attribute) { case "FIXED": fieldDefinition.lengthFormat = ISOFieldLengthFormat.FIXED; break; case "VAR": fieldDefinition.lengthFormat = ISOFieldLengthFormat.VAR; break; } } attribute = reader["lengthcoding"]; if (attribute != null) { switch (attribute) { case "ASCII": fieldDefinition.lengthCoding = ISOFieldCoding.ASCII; break; case "BCD": fieldDefinition.lengthCoding = ISOFieldCoding.BCD; break; case "BCDU": fieldDefinition.lengthCoding = ISOFieldCoding.BCDU; break; case "EBCDIC": fieldDefinition.lengthCoding = ISOFieldCoding.EBCDIC; break; case "BIN": fieldDefinition.lengthCoding = ISOFieldCoding.BIN; break; } } attribute = reader["lengthpadding"]; if (attribute != null) { switch (attribute) { case "LEFT": fieldDefinition.lengthPadding = ISOFieldPadding.LEFT; break; case "RIGHT": fieldDefinition.lengthPadding = ISOFieldPadding.RIGHT; break; case "NONE": fieldDefinition.lengthPadding = ISOFieldPadding.NONE; break; } } attribute = reader["contentformat"]; if (attribute != null) { switch (attribute) { case "A": fieldDefinition.content = ISOFieldContent.A; break; case "AN": fieldDefinition.content = ISOFieldContent.AN; break; case "ANS": fieldDefinition.content = ISOFieldContent.ANS; break; case "AS": fieldDefinition.content = ISOFieldContent.AS; break; case "N": fieldDefinition.content = ISOFieldContent.N; break; case "NS": fieldDefinition.content = ISOFieldContent.NS; break; case "HD": fieldDefinition.content = ISOFieldContent.HD; break; case "TRACK2": fieldDefinition.content = ISOFieldContent.Z; break; case "Z": fieldDefinition.content = ISOFieldContent.Z; break; } } attribute = reader["contentcoding"]; if (attribute != null) { switch (attribute) { case "ASCII": fieldDefinition.contentCoding = ISOFieldCoding.ASCII; break; case "BCD": fieldDefinition.contentCoding = ISOFieldCoding.BCD; // Always N the content since nothing else is possible fieldDefinition.content = ISOFieldContent.N; break; case "BCDU": fieldDefinition.contentCoding = ISOFieldCoding.BCDU; // Always N the content since nothing else is possible fieldDefinition.content = ISOFieldContent.N; break; case "EBCDIC": fieldDefinition.contentCoding = ISOFieldCoding.EBCDIC; break; case "BIN": // Always HD the content since nothing else is possible fieldDefinition.content = ISOFieldContent.HD; fieldDefinition.contentCoding = ISOFieldCoding.BIN; break; case "Z": fieldDefinition.contentCoding = ISOFieldCoding.Z; break; } } attribute = reader["contentpaddingcharacter"]; if (!string.IsNullOrEmpty(attribute)) { if (fieldDefinition.contentCoding == ISOFieldCoding.ASCII || fieldDefinition.contentCoding == ISOFieldCoding.ASCII) { //save as ascii character fieldDefinition.contentPaddingCharacter = (byte)attribute[0]; } else { //padding character should be a hex digit 0-F //save the numeric value of it fieldDefinition.contentPaddingCharacter = Convert.ToByte(attribute, 16); } } attribute = reader["contentpadding"]; if (attribute != null) { switch (attribute) { case "LEFT": fieldDefinition.contentPadding = ISOFieldPadding.LEFT; break; case "RIGHT": fieldDefinition.contentPadding = ISOFieldPadding.RIGHT; break; case "NONE": fieldDefinition.contentPadding = ISOFieldPadding.NONE; break; } } attribute = reader["desc"]; if (attribute != null) { fieldDefinition.description = attribute; } fieldPackager.SetFieldDefinition(fieldDefinition); return(fieldPackager); }
/// <summary> /// /// </summary> /// <param name="isoFieldDefinition"></param> public void SetFieldDefinition(ISOFieldDefinition isoFieldDefinition) { m_isoFieldDefinition = isoFieldDefinition; }
/// <summary> /// /// </summary> /// <param name="logger"></param> /// <param name="isoFieldDefinition"></param> public ISOFieldPackager(ILogger logger, ISOFieldDefinition isoFieldDefinition) : base(logger, isoFieldDefinition) { }
/// <summary> /// /// </summary> /// <param name="logger"></param> /// <param name="fieldNumber"></param> /// <param name="totalFields"></param> /// <param name="isoFieldDefinition"></param> public ISOMessageFieldsPackager(ILogger logger, int fieldNumber, int totalFields, ISOFieldDefinition isoFieldDefinition) : base(logger, isoFieldDefinition) { m_totalFields = totalFields; m_number = fieldNumber; m_composite = true; m_isoMsgTypePackager = new ISOMessageTypesPackager(logger, m_totalFields); m_fieldPackagerList = new ISOPackager[totalFields + 1]; }
/// <summary> /// /// </summary> /// <param name="reader"></param> /// <returns></returns> private ISOFieldPackager LoadISOFieldPackager(XmlReader reader) { ISOFieldDefinition fieldDefinition = new ISOFieldDefinition(); ISOFieldPackager fieldPackager = new ISOFieldPackager(Logger); // Search for the attribute name on this current node. string attribute = reader["number"]; if (attribute != null) { fieldPackager.SetFieldNumber(Int32.Parse(attribute)); } attribute = reader["name"]; if (attribute != null) { fieldDefinition.name = attribute; } attribute = reader["length"]; if (attribute != null) { fieldDefinition.length = Int32.Parse(attribute); } attribute = reader["lengthlength"]; if (attribute != null) { fieldDefinition.lengthLength = Int32.Parse(attribute); } attribute = reader["lengthformat"]; if (attribute != null) { switch (attribute) { case "FIXED": fieldDefinition.lengthFormat = ISOFieldLengthFormat.FIXED; break; case "VAR": fieldDefinition.lengthFormat = ISOFieldLengthFormat.VAR; break; } } attribute = reader["lengthcoding"]; if (attribute != null) { switch (attribute) { case "ASCII": fieldDefinition.lengthCoding = ISOFieldCoding.ASCII; break; case "BCD": fieldDefinition.lengthCoding = ISOFieldCoding.BCD; break; case "BCDU": fieldDefinition.lengthCoding = ISOFieldCoding.BCDU; break; case "EBCDIC": fieldDefinition.lengthCoding = ISOFieldCoding.EBCDIC; break; case "BIN": fieldDefinition.lengthCoding = ISOFieldCoding.BIN; break; } } attribute = reader["lengthpadding"]; if (attribute != null) { switch (attribute) { case "LEFT": fieldDefinition.lengthPadding = ISOFieldPadding.LEFT; break; case "RIGHT": fieldDefinition.lengthPadding = ISOFieldPadding.RIGHT; break; case "NONE": fieldDefinition.lengthPadding = ISOFieldPadding.NONE; break; } } attribute = reader["contentformat"]; if (attribute != null) { switch (attribute) { case "A": fieldDefinition.content = ISOFieldContent.A; break; case "AN": fieldDefinition.content = ISOFieldContent.AN; break; case "ANS": fieldDefinition.content = ISOFieldContent.ANS; break; case "AS": fieldDefinition.content = ISOFieldContent.AS; break; case "N": fieldDefinition.content = ISOFieldContent.N; break; case "NS": fieldDefinition.content = ISOFieldContent.NS; break; case "HD": fieldDefinition.content = ISOFieldContent.HD; break; case "TRACK2": fieldDefinition.content = ISOFieldContent.Z; break; case "Z": fieldDefinition.content = ISOFieldContent.Z; break; } } attribute = reader["contentcoding"]; if (attribute != null) { switch (attribute) { case "ASCII": fieldDefinition.contentCoding = ISOFieldCoding.ASCII; break; case "BCD": fieldDefinition.contentCoding = ISOFieldCoding.BCD; // Always N the content since nothing else is possible fieldDefinition.content = ISOFieldContent.N; break; case "BCDU": fieldDefinition.contentCoding = ISOFieldCoding.BCDU; // Always N the content since nothing else is possible fieldDefinition.content = ISOFieldContent.N; break; case "EBCDIC": fieldDefinition.contentCoding = ISOFieldCoding.EBCDIC; break; case "BIN": // Always HD the content since nothing else is possible fieldDefinition.content = ISOFieldContent.HD; fieldDefinition.contentCoding = ISOFieldCoding.BIN; break; case "Z": fieldDefinition.contentCoding = ISOFieldCoding.Z; break; } } attribute = reader["contentpadding"]; if (attribute != null) { switch (attribute) { case "LEFT": fieldDefinition.contentPadding = ISOFieldPadding.LEFT; break; case "RIGHT": fieldDefinition.contentPadding = ISOFieldPadding.RIGHT; break; case "NONE": fieldDefinition.contentPadding = ISOFieldPadding.NONE; break; } } attribute = reader["desc"]; if (attribute != null) { fieldDefinition.description = attribute; } fieldPackager.SetFieldDefinition(fieldDefinition); return(fieldPackager); }
/// <summary> /// /// </summary> /// <param name="logger"></param> /// <param name="isoFieldDefinition"></param> public ISOPackager(ILogger logger, ISOFieldDefinition isoFieldDefinition) { _logger = logger; m_isoFieldDefinition = isoFieldDefinition; }