From 6f791367066bfd550803bbadd23428cb1daa2e6a Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Sun, 14 Jul 2019 17:35:19 +0100 Subject: [PATCH] Tidy the Intel Hex file parser a little. Signed-off-by: Adrian Conlon --- EightBit/IntelHexFile.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/EightBit/IntelHexFile.cs b/EightBit/IntelHexFile.cs index 1794b9f..e112818 100644 --- a/EightBit/IntelHexFile.cs +++ b/EightBit/IntelHexFile.cs @@ -73,12 +73,10 @@ namespace EightBit var address = Convert.ToUInt16(addressString, 16); var recordTypeString = line.Substring(7, 2); - var recordType = Convert.ToByte(recordTypeString, 16); - - switch (recordType) + switch (Convert.ToByte(recordTypeString, 16)) { case 0x00: - return ParseDataRecord(line, address, count); + return new Tuple(address, ParseDataRecord(line, count)); case 0x01: this.eof = true; @@ -89,7 +87,7 @@ namespace EightBit } } - private static Tuple ParseDataRecord(string line, ushort address, byte count) + private static byte[] ParseDataRecord(string line, byte count) { if (string.IsNullOrEmpty(line)) { @@ -110,7 +108,7 @@ namespace EightBit data[i] = Convert.ToByte(extracted, 16); } - return new Tuple(address, data); + return data; } } }