diff --git a/Lidgren.Network/NetIncomingMessage.Peek.cs b/Lidgren.Network/NetIncomingMessage.Peek.cs index 95c8f25..d0f7fb1 100644 --- a/Lidgren.Network/NetIncomingMessage.Peek.cs +++ b/Lidgren.Network/NetIncomingMessage.Peek.cs @@ -306,22 +306,10 @@ namespace Lidgren.Network /// public string PeekString() { - int byteLen = (int)ReadVariableUInt32(); - - if (byteLen == 0) - return String.Empty; - - NetException.Assert(m_bitLength - m_readPosition >= (byteLen * 8), c_readOverflowError); - - if ((m_readPosition & 7) == 0) - { - // read directly - string retval = System.Text.Encoding.UTF8.GetString(m_data, m_readPosition >> 3, byteLen); - return retval; - } - - byte[] bytes = PeekBytes(byteLen); - return System.Text.Encoding.UTF8.GetString(bytes, 0, bytes.Length); + int wasReadPosition = m_readPosition; + string retval = ReadString(); + m_readPosition = wasReadPosition; + return retval; } } }