コード例 #1
0
        public override object Deserialize(BinaryTypesReader br, Type type, SerializerSettings settings, ISerializerArg serializerArg)
        {
            var typedSerializerArg = GetSerializerArg <DateTimeSerializerArg>(type, settings, serializerArg);

            if (typedSerializerArg != null && typedSerializerArg.TickResolution > 0)
            {
                return(new TimeSpan(br.Read7BitLong() * typedSerializerArg.TickResolution));
            }

            return(new TimeSpan(br.Read7BitLong()));
        }
コード例 #2
0
        public override object Deserialize(BinaryTypesReader br, Type type, SerializerSettings settings, ISerializerArg serializerArg)
        {
            var typedSerializerArg = GetSerializerArg <DateTimeSerializerArg>(type, settings, serializerArg);

            if (typedSerializerArg != null && typedSerializerArg.TickResolution > 0)
            {
                return(br.ReadCompactDateTime(typedSerializerArg.TickResolution));
            }

            return(new DateTime(br.Read7BitLong(), DateTimeKind.Utc)); //todo: compact
        }
コード例 #3
0
        public override object Deserialize(BinaryTypesReader br, Type type, SerializerSettings settings, ISerializerArg serializerArg)
        {
            var val = br.Read7BitLong();

            return(Convert.ChangeType(val, type));
        }
コード例 #4
0
        public override object Deserialize(BinaryTypesReader br, Type type, SerializerSettings settings, ISerializerArg serializerArg)
        {
            int val = (int)br.Read7BitLong();

            return(Enum.ToObject(type, val));
        }