public bool TryReadFieldId(out StFieldId field) { if (data.Length <= ConsumedBytes) { field = new StFieldId(StTypeCode.NotPresent, 0); return(false); } var byte1 = data[ConsumedBytes]; if (byte1 == 0) { // low 4 bits == 0 && high 4 bits == 0 if (data.Length <= ConsumedBytes + 2) { field = new StFieldId(StTypeCode.NotPresent, 0); return(false); } field = new StFieldId( (StTypeCode)data[ConsumedBytes + 1], data[ConsumedBytes + 2]); ConsumedBytes += 3; return(true); } else if (byte1 < 16) { // low 4 bits <> 0 && high 4 bits == 0 if (data.Length <= ConsumedBytes + 1) { field = new StFieldId(StTypeCode.NotPresent, 0); return(false); } field = new StFieldId( (StTypeCode)data[ConsumedBytes + 1], byte1); ConsumedBytes += 2; return(true); } else if ((byte1 & 0x0F) == 0 && (byte1 & 0xF0) != 0) { // low 4 bits == 0 && high 4 bits <> 0 if (data.Length <= ConsumedBytes + 1) { field = new StFieldId(StTypeCode.NotPresent, 0); return(false); } field = new StFieldId( (StTypeCode)(byte1 >> 4), data[ConsumedBytes + 1]); ConsumedBytes += 2; return(true); } else { // low 4 bits <> 0 && high 4 bits <> 0 field = new StFieldId( (StTypeCode)(byte1 >> 4), (uint)byte1 & 0x0F); ConsumedBytes += 1; return(true); } }
public bool Equals(StFieldId other) { return(this == other); }