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

AddToTransactionLog() публичный Метод

public AddToTransactionLog ( TransactionEntry entry ) : void
entry TransactionEntry
Результат void
        public void AddToTransactionLog(TransactionEntry entry)
        {
            entry.TransactionNumber = _transCollection.Count + 1;
            _transCollection.Add(entry);
            //SaveTransactionLog();
            AddTransactionToFile(entry, true);
            //UpdateNumberOfTransActions();
            //UpdateChecksum();
        }

Usage Example

Пример #1
0
        public void savedatatobinary(int address, int length, byte[] data, string filename, bool DoTransActionEntry, string note, EDCFileType type)
        {
            // depends on filetype (EDC16 is not reversed)
            if (type != EDCFileType.EDC16)
            {
                data = reverseEndian(data);
            }
            if (address > 0 && address < m_currentfilelength)
            {
                try
                {
                    byte[] beforedata = readdatafromfile(filename, address, length, type);

                    FileStream   fsi1 = File.OpenWrite(filename);
                    BinaryWriter bw1  = new BinaryWriter(fsi1);
                    fsi1.Position = address;
                    for (int i = 0; i < length; i++)
                    {
                        bw1.Write((byte)data.GetValue(i));
                    }
                    fsi1.Flush();
                    bw1.Close();
                    fsi1.Close();
                    fsi1.Dispose();

                    if (m_ProjectTransactionLog != null && DoTransActionEntry)
                    {
                        // depends on filetype (EDC16 is not reversed)
                        if (type != EDCFileType.EDC16)
                        {
                            data = reverseEndian(data);
                        }
                        TransactionEntry tentry = new TransactionEntry(DateTime.Now, address, length, beforedata, data, 0, 0, note);
                        m_ProjectTransactionLog.AddToTransactionLog(tentry);
                        if (m_CurrentWorkingProject != string.Empty)
                        {
                            m_ProjectLog.WriteLogbookEntry(LogbookEntryType.TransactionExecuted, GetSymbolNameByAddress(address) + " " + note);
                        }
                    }
                }
                catch (Exception E)
                {
                    frmInfoBox info = new frmInfoBox("Failed to write to binary. Is it read-only? Details: " + E.Message);
                }
            }
        }