private void CompareTick(BinaryReader reader)
        {
            byte version = reader.ReadByte();

            currentTick.FromReader(version, reader);
            CompareTick(currentTick);
        }
Example #2
0
        private bool TryReadTick(long length)
        {
            tickIO.SetSymbol(lSymbol);
            byte size = dataIn.ReadByte();

            // Check for old style prior to version 8 where
            // single byte version # was first.
            if (dataVersion < 8 && size < 8)
            {
                tickIO.FromReader((byte)size, dataIn);
            }
            else
            {
                // Subtract the size byte.
                if (dataIn.BaseStream.Position + size - 1 > length)
                {
                    return(false);
                }
                int count = 1;
                memory.SetLength(size);
                memory.GetBuffer()[0] = size;
                while (count < size)
                {
                    count += dataIn.Read(buffer, count, size - count);
                }
                memory.Position = 0;
                tickIO.FromReader(memory);
                if (dataVersion == 0)
                {
                    dataVersion = tickIO.DataVersion;
                }
            }
            var utcTime = new TimeStamp(tickIO.Extract().UtcTime);

            tickIO.SetTime(utcTime);
            return(true);
        }