VAGSuite.TransactionLog.AddTransactionToFile C# (CSharp) Метод

AddTransactionToFile() приватный Метод

private AddTransactionToFile ( TransactionEntry entry, bool updateChecksum ) : void
entry TransactionEntry
updateChecksum bool
Результат void
        private void AddTransactionToFile(TransactionEntry entry, bool updateChecksum)
        {
            // append at the end of the file
            //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
            AppendInt32ToFile(entry.TransactionNumber);
            AppendByteToFile(Convert.ToByte(entry.IsRolledBack)); // not rolled back
            AppendByteToFile(Convert.ToByte(entry.EntryDateTime.Day));
            AppendByteToFile(Convert.ToByte(entry.EntryDateTime.Month));
            AppendInt16ToFile(Convert.ToInt16(entry.EntryDateTime.Year));
            AppendByteToFile(Convert.ToByte(entry.EntryDateTime.Hour));
            AppendByteToFile(Convert.ToByte(entry.EntryDateTime.Minute));
            AppendByteToFile(Convert.ToByte(entry.EntryDateTime.Second));
            AppendInt32ToFile(entry.SymbolAddress);
            AppendInt16ToFile(Convert.ToInt16(entry.Note.Length * 2));
            // now add double hex all characters
            for (int i = 0; i < entry.Note.Length; i++)
            {
                byte curByte = Convert.ToByte(entry.Note[i]);
                string Hex = curByte.ToString("X2");
                AppendByteToFile(Convert.ToByte(Hex[0]));
                AppendByteToFile(Convert.ToByte(Hex[1]));
            }
            AppendInt16ToFile(Convert.ToInt16(entry.SymbolLength));
            AppendDataToFile(entry.DataBefore);
            AppendDataToFile(entry.DataAfter);
            // update number of entries
            Int32 _entryCount = readInt32FromFile(m_fileName, 4);
            _entryCount++;

            if (updateChecksum)
            {
                writeInt32ToFile(m_fileName, 4, _entryCount);
                UpdateChecksum();
            }
            // update checksum
        }