internal void Scan(Byte[] buffer, int offset) { // Reset the internal state. _sharedBuffer = buffer; _typeTags.Clear(); _offsets.Clear(); // Read type tags. offset++; // "," while (true) { var tag = (char)buffer[offset]; if (!OscDataTypes.IsSupportedTag(tag)) { break; } _typeTags.Add(tag); offset++; } offset += OscDataTypes.GetStringSize(buffer, offset); // Determine the offsets of the each element. foreach (var tag in _typeTags) { _offsets.Add(offset); if (tag == 'i' || tag == 'f') { offset += 4; } if (tag == 'd') { offset += 8; } else if (tag == 's') { offset += OscDataTypes.GetStringSize(buffer, offset); } else // tag == 'b' { offset += 4 + OscDataTypes.ReadInt(buffer, offset); } } }
internal void Scan(byte[] buffer, int offset) { // Reset the internal state. _sharedBuffer = buffer; _typeTags.Clear(); _offsets.Clear(); // Read type tags. offset++; // "," while (true) { var tag = (char)buffer[offset]; if (!OscDataTypes.IsSupportedTag(tag)) { break; } _typeTags.Add(tag); offset++; } offset += OscDataTypes.GetStringSize(buffer, offset); // Determine the offsets of the each element. foreach (var tag in _typeTags) { _offsets.Add(offset); switch (tag) { case 'i': case 'f': offset += 4; break; case 's': offset += OscDataTypes.GetStringSize(buffer, offset); break; // tag == 'b' default: offset += 4 + OscDataTypes.ReadInt(buffer, offset); break; } } }