Example #1
0
        public static new OSCBundle Parse(BinaryReader reader)
        {
            OSCString  bundleString = OSCString.Parse(reader);
            OSCTimeTag timeTag      = OSCTimeTag.Parse(reader);

            List <OSCPacket> contents = new List <OSCPacket>();

            while (reader.BaseStream.Position < reader.BaseStream.Length)
            {
                OSCInt    size   = OSCInt.Parse(reader);
                OSCPacket packet = OSCPacket.Parse(reader);
                contents.Add(packet);
            }

            return(new OSCBundle(timeTag.Contents, contents));
        }
Example #2
0
        public OSCBundle(DateTime time, IEnumerable <OSCPacket> contents)
        {
            Contents = new List <OSCPacket>(contents);

            Bytes = new byte[GetByteLength()];
            MemoryStream stream       = new MemoryStream(Bytes);
            OSCString    bundleString = new OSCString("#bundle");

            stream.Write(bundleString.Bytes, 0, bundleString.Bytes.Length);
            TimeTag = new OSCTimeTag(time);
            stream.Write(TimeTag.Bytes, 0, TimeTag.Bytes.Length);

            foreach (OSCPacket message in contents)
            {
                stream.Write(OSCInt.GetBigEndianIntBytes(message.Bytes.Length), 0, sizeof(int));
                stream.Write(message.Bytes, 0, message.Bytes.Length);
            }
        }
Example #3
0
 public void TestParsing(Int32 value)
 {
     Assert.Equal(value, OSCValueTester.TestOSCValueParser(value, (reader) => OSCInt.Parse(reader)));
 }