示例#1
0
        /// <inheritdoc />
        public override CtfFieldValue Read(IPacketReader reader, CtfFieldValue parent = null)
        {
            Guard.NotNull(reader, nameof(reader));

            reader.Align((uint)this.Align);

            byte[] buffer = null;
            if ((Exponent + Mantissa) == 32)
            {
                buffer = reader.ReadBits(32);
            }
            else if ((Exponent + Mantissa) == 64)
            {
                buffer = reader.ReadBits(64);
            }
            if (buffer == null)
            {
                throw new CtfPlaybackException("IPacketReader.ReadBits returned null while reading an floating_point value.");
            }

            int byteCount = buffer.Length;

            return(this.Read(buffer, byteCount));
        }
        /// <inheritdoc />
        public override CtfFieldValue Read(IPacketReader reader, CtfFieldValue parent = null)
        {
            Guard.NotNull(reader, nameof(reader));

            reader.Align((uint)this.Align);
            byte[] buffer = reader.ReadBits((uint)this.Size);
            if (buffer == null)
            {
                throw new CtfPlaybackException("IPacketReader.ReadBits returned null while reading an integer value.");
            }

            int byteCount = buffer.Length;

            return(this.Read(buffer, byteCount));
        }