MySql.Data.MySqlClient.MySqlPacket.ReadBitValue C# (CSharp) Method

ReadBitValue() public method

public ReadBitValue ( int numbytes ) : ulong
numbytes int
return ulong
    public ulong ReadBitValue(int numbytes)
    {
      ulong value = 0;

      int pos = (int)buffer.Position;
      byte[] bits = buffer.GetBuffer();
      int shift = 0;

      for (int i = 0; i < numbytes; i++)
      {
        value <<= shift;
        value |= bits[pos++];
        shift = 8;
      }
      buffer.Position += numbytes;
      return value;
    }

Usage Example

Esempio n. 1
0
    public IMySqlValue ReadValue(MySqlPacket packet, long length, bool isNull)
    {
      this.isNull = isNull;
      if (isNull)
        return this;

      if (length == -1)
        length = packet.ReadFieldLength();

      if (ReadAsString)
        mValue = UInt64.Parse(packet.ReadString(length));
      else
        mValue = (UInt64)packet.ReadBitValue((int)length);
      return this;
    }
All Usage Examples Of MySql.Data.MySqlClient.MySqlPacket::ReadBitValue