static int DecodeFlags (byte[] buffer, ref int index)
{
short nbytes = BitConverterLE.ToInt16 (buffer, index);
int flags;
index += 2;
switch (nbytes) {
case 4: flags = BitConverterLE.ToInt32 (buffer, index); break;
case 2: flags = BitConverterLE.ToInt16 (buffer, index); break;
default: flags = 0; break;
}
index += nbytes;
return flags;
}