Lidgren.Network.NetBuffer.ReadBytes C# (CSharp) Méthode

ReadBytes() public méthode

Reads the specified number of bytes and returns true for success
public ReadBytes ( int numberOfBytes, byte &result ) : bool
numberOfBytes int
result byte
Résultat bool
        public bool ReadBytes(int numberOfBytes, out byte[] result)
        {
            if (m_bitLength - m_readPosition + 7 < (numberOfBytes * 8))
            {
                result = null;
                return false;
            }

            result = new byte[numberOfBytes];
            NetBitWriter.ReadBytes(m_data, numberOfBytes, m_readPosition, result, 0);
            m_readPosition += (8 * numberOfBytes);
            return true;
        }

Same methods

NetBuffer::ReadBytes ( int numberOfBytes ) : byte[]
NetBuffer::ReadBytes ( byte into, int offset, int numberOfBytes ) : void

Usage Example

Exemple #1
0
 public void Read(NetBuffer im)
 {
     MessagePacketId = im.ReadInt64();
     Number          = im.ReadInt32();
     int length      = im.ReadInt32();
     if (length != 0)
     {
         Bytes = im.ReadBytes(length);
     }
 }
All Usage Examples Of Lidgren.Network.NetBuffer::ReadBytes