Exemplo n.º 1
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);
   }
 }
Exemplo n.º 2
0
        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.UTF8.GetString(bytes.ToArray(), 0, bytes.ToArray().Length);
            OscString oscString   = new OscString(str);
            int       bytesToBurn = oscString.Bytes.Length - bytes.Count - 1;

            for (int i = 0; i < bytesToBurn; i++)
            {
                reader.ReadByte();
            }
            return(oscString);
        }