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())); }
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 }
public override object Deserialize(BinaryTypesReader br, Type type, SerializerSettings settings, ISerializerArg serializerArg) { var val = br.Read7BitLong(); return(Convert.ChangeType(val, type)); }
public override object Deserialize(BinaryTypesReader br, Type type, SerializerSettings settings, ISerializerArg serializerArg) { int val = (int)br.Read7BitLong(); return(Enum.ToObject(type, val)); }