public ulong ReadULong(int numbytes)
{
Debug.Assert((buffer.Position + numbytes) <= buffer.Length);
byte[] bytes = buffer.GetBuffer();
int pos = (int)buffer.Position;
buffer.Position += numbytes;
switch (numbytes)
{
case 2: return BitConverter.ToUInt16(bytes, pos);
case 4: return BitConverter.ToUInt32(bytes, pos);
case 8: return BitConverter.ToUInt64(bytes, pos);
}
throw new NotSupportedException("Only byte lengths of 2, 4, or 8 are supported");
}
IMySqlValue IMySqlValue.ReadValue(MySqlPacket packet, long length, bool nullVal) { if (nullVal) return new MySqlUInt64(true); if (length == -1) return new MySqlUInt64(packet.ReadULong(8)); else return new MySqlUInt64(UInt64.Parse(packet.ReadString(length))); }