public static string ReadString(this Stream stream)
        {
            var count = (int)ZigZag.DeserializeUInt32(stream);
            var bytes = stream.ReadBytes(count);

            return(Encoding.UTF8.GetString(bytes));
        }
        public object Deserialize(System.IO.Stream stream)
        {
            var id = ZigZag.DeserializeUInt32(stream);

            if ((id & 1) != 0)
            {
                return(null);
            }
            var type = map.GetType(id >> 1);

            return(serializer.Get(type).Deserialize(stream));
        }
        public object Deserialize(Stream stream)
        {
            int count = (int)ZigZag.DeserializeUInt32(stream);
            var types = new TypeMap();

            while (count-- != 0)
            {
                uint tag      = ZigZag.DeserializeUInt32(stream);
                var  typeName = stream.ReadString();
                var  type     = this.typeNames.GetType(typeName);
                types.Add(tag, typeName, type);
            }
            return(types);
        }
        public object Deserialize(System.IO.Stream stream)
        {
            var count = ZigZag.DeserializeUInt32(stream);

            if (count == 1)
            {
                return(null);
            }
            int c     = (int)(count >> 1);
            var array = (Array)newObj(c);

            for (int i = 0; i < c; i++)
            {
                setter(array, i, ser.Deserialize(stream));
            }
            return(array);
        }
Beispiel #5
0
        public object Deserialize(System.IO.Stream stream)
        {
            var count = ZigZag.DeserializeUInt32(stream);

            if (count == 1)
            {
                return(null);
            }
            int c   = (int)(count >> 1);
            var obj = newObj();

            while (c-- != 0)
            {
                var x = ser.Deserialize(stream).WrapIfValueType();
                add(obj, key(x), value(x));
            }
            return(obj);
        }
        public object Deserialize(System.IO.Stream stream)
        {
            var count = ZigZag.DeserializeUInt32(stream);

            if (count == 1)
            {
                return(null);
            }
            int c   = (int)(count >> 1);
            var obj = newObj();

            while (c-- != 0)
            {
                var v = ser.Deserialize(stream);
                add(obj, v);
            }
            classSer.DeserializeInto(stream, obj);
            return(obj);
        }
        public object Deserialize(System.IO.Stream stream)
        {
            uint a = ZigZag.DeserializeUInt32(stream);

            return(*(float *)&a);
        }
Beispiel #8
0
 public object Deserialize(System.IO.Stream stream)
 {
     return(ZigZag.DeserializeUInt32(stream));
 }