Esempio n. 1
0
        public DbfMemoEntry CreateEntry(string value)
        {
            int requiredBlocks = (value.Length + BlockHeaderSize) / BlockSize + 1;
            var newData        = new byte[Data.Length + requiredBlocks * BlockSize];

            Buffer.BlockCopy(Data, 0, newData, 0, Data.Length);
            Buffer.BlockCopy(EndianBitConverter.Big.GetBytes(1U), 0, newData, Data.Length, 4);
            Buffer.BlockCopy(EndianBitConverter.Big.GetBytes((uint)value.Length), 0, newData, Data.Length + 4, 4);
            Buffer.BlockCopy(Encoding.GetBytes(value), 0, newData, Data.Length + BlockHeaderSize, value.Length);
            int nextBlockOffset = NextBlockOffset + requiredBlocks;

            Buffer.BlockCopy(EndianBitConverter.Big.GetBytes((uint)nextBlockOffset), 0, newData, 0, 4);
            var newEntry = new DbfMemoEntry(NextBlockOffset, value);

            Data            = newData;
            NextBlockOffset = nextBlockOffset;

            return(newEntry);
        }
Esempio n. 2
0
 public bool ContainsEntry(DbfMemoEntry entry) => ContainsEntry(entry.Index);