/// <summary> /// Appends a value to the packet. /// </summary> /// <typeparam name="T">The type of object being appended.</typeparam> /// <param name="value">The value to append.</param> /// <returns>The index of the newly added value within the Data property.</returns> /// <remarks>The value must be of type OscPacket.</remarks> public override int Append <T>(T value) { Assert.IsTrue(value is OscPacket); OscBundle nestedBundle = value as OscBundle; if (nestedBundle != null) { Assert.IsTrue(nestedBundle.mTimeStamp >= mTimeStamp); } mData.Add(value); return(mData.Count - 1); }
/// <summary> /// Deserialize the packet. /// </summary> /// <param name="sourceEndPoint">The packet origin.</param> /// <param name="data">The serialized packet.</param> /// <param name="start">The starting index into the serialized data stream.</param> /// <param name="end">The ending index into the serialized data stream.</param> /// <returns>The newly deserialized packet.</returns> public static new OscBundle FromByteArray(IPEndPoint sourceEndPoint, byte[] data, ref int start, int end) { string address = OscPacket.ValueFromByteArray <string>(data, ref start); Assert.IsTrue(address == BundlePrefix); OscTimeTag timeStamp = OscPacket.ValueFromByteArray <OscTimeTag>(data, ref start); OscBundle bundle = new OscBundle(sourceEndPoint, timeStamp); while (start < end) { int length = OscPacket.ValueFromByteArray <int>(data, ref start); int packetEnd = start + length; bundle.Append(OscPacket.FromByteArray(sourceEndPoint, data, ref start, packetEnd)); } return(bundle); }
/// <summary> /// Initializes a new instance of the <see cref="OscBundleReceivedEventArgs"/> class. /// </summary> /// <param name="bundle">The <see cref="OscBundle"/> received.</param> public OscBundleReceivedEventArgs(OscBundle bundle) { Assert.ParamIsNotNull(bundle); mBundle = bundle; }