Ejemplo n.º 1
0
        /// <summary>
        /// Reads a double from EBML Element's data section.
        /// </summary>
        /// <returns>a double containing the parsed value.</returns>
        public double ReadDouble()
        {
            if (file == null)
            {
                return(0);
            }

            if (ebml_size != 4 && ebml_size != 8)
            {
                throw new UnsupportedFormatException("Can not read a Double with sizes differing from 4 or 8");
            }

            file.Seek((long)data_offset);

            ByteVector vector = file.ReadBlock((int)ebml_size);

            double result = 0.0;

            if (ebml_size == 4)
            {
                result = (double)vector.ToFloat();
            }
            else if (ebml_size == 8)
            {
                result = vector.ToDouble();
            }

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Get a double from EBML Element's data section.
        /// </summary>
        /// <returns>a double containing the parsed value.</returns>
        public double GetDouble()
        {
            if (Data == null)
            {
                return(0);
            }
            if (Data.Count == 4)
            {
                return(Data.ToFloat());
            }

            if (Data.Count == 8)
            {
                return(Data.ToDouble());
            }
            throw new UnsupportedFormatException("Can not read a Double with sizes differing from 4 or 8");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get a double from EBML Element's data section.
        /// </summary>
        /// <returns>a double containing the parsed value.</returns>
        public double GetDouble()
        {
            if (Data == null)
            {
                return(0);
            }

            var result = 0.0;

            if (Data.Count == 4)
            {
                result = Data.ToFloat();
            }
            else if (Data.Count == 8)
            {
                result = Data.ToDouble();
            }
            else
            {
                throw new UnsupportedFormatException("Can not read a Double with sizes differing from 4 or 8");
            }

            return(result);
        }