public static OSCPacket Unpack(byte[] bytes, ref int start, int end) { if (bytes[start] == '#') { return(OSCBundle.Unpack(bytes, ref start, end)); } else { return(OSCMessage.Unpack(bytes, ref start)); } }
public static new OSCBundle Unpack(byte[] bytes, ref int start, int end) { string address = unpackString(bytes, ref start); //Console.WriteLine("bundle: " + address); if (!address.Equals(BUNDLE)) { return(null); // TODO } long timestamp = unpackLong(bytes, ref start); OSCBundle bundle = new OSCBundle(timestamp); while (start < end) { int length = unpackInt(bytes, ref start); int sub_end = start + length; //Console.WriteLine(bytes.Length +" "+ start+" "+length+" "+sub_end); bundle.Append(OSCPacket.Unpack(bytes, ref start, sub_end)); } return(bundle); }