Exemplo n.º 1
0
        public override byte[] ToBytes()
        {
            var bytes            = new byte[4 + CalculatePaddedArrayLength(Value.Length)];
            var valueLengthBytes = new OscInt(Value.Length).ToBytes();

            Array.Copy(valueLengthBytes, 0, bytes, 0, 4);
            Array.Copy(Value, 0, bytes, 4, Value.Length);

            return(bytes);
        }
Exemplo n.º 2
0
        public static byte[] GetValue(ref byte[] bytes)
        {
            var length       = OscInt.GetValue(ref bytes);
            var valueBytes   = bytes.Take(length).ToArray();
            var paddedLength = CalculatePaddedArrayLength(length, false);

            bytes = bytes.Skip(paddedLength).ToArray();

            return(valueBytes);
        }
Exemplo n.º 3
0
        public static OscValue FromBytes(char tag, ref byte[] bytes)
        {
            switch (tag)
            {
            case 'i': return(OscInt.FromBytes(ref bytes));

            case 'f': return(OscFloat.FromBytes(ref bytes));

            case 's': return(OscString.FromBytes(ref bytes));

            case 'b': return(OscBlob.FromBytes(ref bytes));

            default: throw new OscException($"Unable to read OSC argument with tag '{tag}'.");
            }
        }