Ejemplo n.º 1
0
        /// <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 new static OscBundleReference FromByteArray
            (IPEndPoint sourceEndPoint, byte[] data, ref int start, int end)
        {
            var address = ValueFromByteArray <string>(data, ref start);

            Assert.IsTrue(address == BundlePrefix);

            var timeStamp = ValueFromByteArray <OscTimeTag>(data, ref start);
            var bundle    = new OscBundleReference(sourceEndPoint, timeStamp);

            while (start < end)
            {
                var length    = ValueFromByteArray <int>(data, ref start);
                var packetEnd = start + length;
                bundle.Append(OscPacketReference.FromByteArray(sourceEndPoint, data, ref start, packetEnd));
            }

            return(bundle);
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Deserialize the packetReference.
 /// </summary>
 /// <param name="sourceEndPoint">The packetReference origin.</param>
 /// <param name="data">The serialized packetReference.</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 packetReference.</returns>
 public static OscPacketReference FromByteArray(IPEndPoint sourceEndPoint, byte[] data, ref int start, int end)
 {
     return(data[start] == '#'
                ? (OscPacketReference)OscBundleReference.FromByteArray(sourceEndPoint, data, ref start, end)
                : OscMessageReference.FromByteArray(sourceEndPoint, data, ref start));
 }