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 string GetElementAsString(int index) { if (index >= _typeTags.Count) { return(""); } var tag = _typeTags[index]; var offs = _offsets[index]; if (tag == 's') { return(OscDataTypes.ReadString(_sharedBuffer, offs)); } if (tag == 'i') { return(OscDataTypes.ReadInt(_sharedBuffer, offs).ToString()); } if (tag == 'f') { return(OscDataTypes.ReadFloat(_sharedBuffer, offs).ToString()); } return(""); }
public string GetElementAsString(int index) { if (index >= _typeTags.Count) { return(""); } var tag = _typeTags[index]; var offs = _offsets[index]; switch (tag) { case 's': return(OscDataTypes.ReadString(_sharedBuffer, offs)); case 'i': return(OscDataTypes.ReadInt(_sharedBuffer, offs).ToString()); case 'f': return(OscDataTypes.ReadFloat(_sharedBuffer, offs).ToString()); default: return(""); } }