Esempio n. 1
0
        private long GetTxAddress()
        {
            long oldAddress = -1;
            byte oldCheck   = 0;

            while (true)
            {
                var address = _data.ReadInt64(0);
                var check   = _data.ReadByte(8);

                if (address == oldAddress && check == oldCheck)
                {
                    throw new NFSdbInvalidTxAddressException(address,
                                                             "Check sum does not match address value and does not change on re-read");
                }

                var actual = GetCheckByte(address);
                if (actual == check)
                {
                    return(address);
                }
                oldAddress = address;
                oldCheck   = check;
            }
        }
Esempio n. 2
0
        private static long ReadLong(IRawFile txFile, ref long offset)
        {
            long result = 0;

            for (int i = 0; i < LONG_ASCII_LEN; i++)
            {
                var b = txFile.ReadByte(i + offset);
                if (b != 0 && b >= ASCII_ZERO && b <= ASCII_NINE)
                {
                    result *= 10;
                    result += b - ASCII_ZERO;
                }
                else
                {
                    break;
                }
            }
            offset += LONG_ASCII_LEN;
            return(result);
        }
Esempio n. 3
0
 public byte GetByte(long rowID)
 {
     return(_storage.ReadByte(rowID * _sizeBytes));
 }