private void ScanMessage(byte[] buffer, int offset, int length) { // Where the next element begins if any var next = offset + length; // OSC address var address = OscDataTypes.ReadString(buffer, offset); offset += OscDataTypes.Align4(address.Length + 1); if (address == "#bundle") { // We don't use the timestamp data; Just skip it. offset += 8; // Keep reading until the next element begins. while (offset < next) { // Get the length of the element. var elementLength = OscDataTypes.ReadInt(buffer, offset); offset += 4; // Scan the bundle element in a recursive fashion. ScanMessage(buffer, offset, elementLength); offset += elementLength; } } else { // Retrieve the arguments and dispatch the message. _dataHandle.Scan(buffer, offset); _dispatcher.Dispatch(address, _dataHandle); } }
public void Append(string data) { var len = data.Length; for (var i = 0; i < len; i++) { _buffer[_length++] = (Byte)data[i]; } var len4 = OscDataTypes.Align4(len + 1); for (var i = len; i < len4; i++) { _buffer[_length++] = 0; } }