Lidgren.Network.NetIncomingMessage.PeekSingle C# (CSharp) Méthode

PeekSingle() public méthode

Reads a 32-bit Single without advancing the read pointer
public PeekSingle ( ) : float
Résultat float
        public float PeekSingle()
        {
            NetException.Assert(m_bitLength - m_readPosition >= 32, c_readOverflowError);

            if ((m_readPosition & 7) == 0) // read directly
            {
                // endianness is handled inside BitConverter.ToSingle
                float retval = BitConverter.ToSingle(m_data, m_readPosition >> 3);
                return retval;
            }

            byte[] bytes = PeekBytes(4);
            return BitConverter.ToSingle(bytes, 0); // endianness is handled inside BitConverter.ToSingle
        }