protected List<int> ProcessInt32List(SubStream data)
 {
     List<int> vals = new List<int>();
     int nents = data.ReadInt32();
     for (int i = 0; i < nents; i++)
     {
         vals.Add(data.ReadInt32());
     }
     return vals;
 }
        protected List <int> ProcessInt32List(SubStream data)
        {
            List <int> vals  = new List <int>();
            int        nents = data.ReadInt32();

            for (int i = 0; i < nents; i++)
            {
                vals.Add(data.ReadInt32());
            }
            return(vals);
        }
        protected dynamic ProcessValue(SubStream data, List <string> path)
        {
            int type = data.ReadByte();

            switch ((char)type)
            {
            case 'T': return(ProcessKeyValuePairs(data, path));

            case 'I': return(ProcessInt32List(data));

            case 'i': return(data.ReadInt32());

            case 'F': return(ProcessSingleList(data));

            case 'f': return(data.ReadSingle());

            case 'S': return(ProcessStringList(data));

            case 's': return(data.ReadString());

            case 'M': return(ProcessList(data, path));

            case '.': return(null);

            case 'R': return(ProcessRawBinary(data));

            default:
                throw new NotImplementedException(String.Format("Unknown type {0} ({0:X8}) at position {1}", (char)type, data.Position));
            }
        }
        protected byte[] ProcessRawBinary(SubStream data)
        {
            List <object> vals  = new List <object>();
            int           nents = data.ReadInt32();

            byte[] rawdata = data.ReadBytes(nents);
            return(rawdata);
        }
        protected List <dynamic> ProcessList(SubStream data, List <string> path)
        {
            List <object> vals  = new List <object>();
            int           nents = data.ReadInt32();

            for (int i = 0; i < nents; i++)
            {
                List <string> _path = path.ToList();
                _path.Add("");
                vals.Add(ProcessValue(data, _path));
            }
            return(vals);
        }
 protected byte[] ProcessRawBinary(SubStream data)
 {
     List<object> vals = new List<object>();
     int nents = data.ReadInt32();
     byte[] rawdata = data.ReadBytes(nents);
     return rawdata;
 }
 protected List<dynamic> ProcessList(SubStream data, List<string> path)
 {
     List<object> vals = new List<object>();
     int nents = data.ReadInt32();
     for (int i = 0; i < nents; i++)
     {
         List<string> _path = path.ToList();
         _path.Add("");
         vals.Add(ProcessValue(data, _path));
     }
     return vals;
 }
 protected dynamic ProcessValue(SubStream data, List<string> path)
 {
     int type = data.ReadByte();
     switch ((char)type)
     {
         case 'T': return ProcessKeyValuePairs(data, path);
         case 'I': return ProcessInt32List(data);
         case 'i': return data.ReadInt32();
         case 'F': return ProcessSingleList(data);
         case 'f': return data.ReadSingle();
         case 'S': return ProcessStringList(data);
         case 's': return data.ReadString();
         case 'M': return ProcessList(data, path);
         case '.': return null;
         case 'R': return ProcessRawBinary(data);
         default:
             throw new NotImplementedException(String.Format("Unknown type {0} ({0:X8}) at position {1}", (char)type, data.Position));
     }
 }