public TransactionCollection ReadTransactionFileVersion1(string filename)
{
TransactionCollection m_transCollection = new TransactionCollection();
Int32 _entryCount = readInt32FromFile(filename, 4);
FileStream fs = new FileStream(filename, FileMode.Open);
fs.Seek(8, SeekOrigin.Begin);
using (BinaryReader br = new BinaryReader(fs))
{
//1 byte hex day, 1 byte hex month, 2 bytes hex year, 1 byte hex hour 1 byte hex minute, 1 byte hex second, 4 bytes hex address, 2 bytes hex length, x bytes hex (data) before, x bytes (data) after
for (int t = 0; t < _entryCount; t++)
{
Int32 transActionNumber = br.ReadInt32();
byte isRolledBack = br.ReadByte();
byte day = br.ReadByte();
byte month = br.ReadByte();
Int16 year = br.ReadInt16();
byte hour = br.ReadByte();
byte minute = br.ReadByte();
byte second = br.ReadByte();
DateTime entryDateTime = new DateTime(year, Convert.ToInt16(month), Convert.ToInt16(day), Convert.ToInt16(hour), Convert.ToInt16(minute), Convert.ToInt16(second));
Int32 address = br.ReadInt32();
Int16 length = br.ReadInt16();
byte[] beforeData = br.ReadBytes(length);
byte[] afterData = br.ReadBytes(length);
// read day
TransactionEntry entry = new TransactionEntry(entryDateTime, address, length, beforeData, afterData, isRolledBack, transActionNumber, "");
m_transCollection.Add(entry);
}
}
fs.Close();
return m_transCollection;
}