public static OSCString Parse(BinaryReader reader)
        {
            List <byte> bytes   = new List <byte>();
            byte        current = reader.ReadByte();

            while (current != 0)
            {
                bytes.Add(current);
                current = reader.ReadByte();
            }
            string    str         = Encoding.ASCII.GetString(bytes.ToArray());
            OSCString oscString   = new OSCString(str);
            int       bytesToBurn = oscString.Bytes.Length - bytes.Count - 1;

            for (int i = 0; i < bytesToBurn; i++)
            {
                reader.ReadByte();
            }
            return(oscString);
        }
Exemple #2
0
        public static IOSCValue Parse(char typeTag, BinaryReader reader)
        {
            switch (typeTag)
            {
            case 'i':
                return(OSCInt.Parse(reader));

            case 'f':
                return(OSCFloat.Parse(reader));

            case 's':
                return(OSCString.Parse(reader));

            case 'b':
                return(OSCBlob.Parse(reader));

            case 'T':
                return(new OSCTrue());

            case 'F':
                return(new OSCFalse());

            case 'N':
                return(new OSCNull());

            case 'I':
                return(new OSCImpulse());

            case 't':
                return(OSCTimeTag.Parse(reader));

            case 'c':
                return(OSCColor.Parse(reader));

            case 'm':
                return(OSCMidi.Parse(reader));

            default:
                throw new ArgumentException("No such type tag as " + typeTag);
            }
        }