Exemplo n.º 1
0
        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            if (t == typeof(CoverType))
            {
                return(CoverTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(MinimumAvailability))
            {
                return(MinimumAvailabilityExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(ScanType))
            {
                return(ScanTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(PathState))
            {
                return(PathStateExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Status))
            {
                return(StatusExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(SourceType))
            {
                return(SourceTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Level))
            {
                return(LevelExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Protocol))
            {
                return(ProtocolExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(MappingResult))
            {
                return(MappingResultExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Value) || t == typeof(Value?))
            {
                return(new Value(reader, serializer));
            }

            if (t == typeof(CoverType?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(CoverTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(MinimumAvailability?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(MinimumAvailabilityExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(ScanType?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(ScanTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(PathState?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(PathStateExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Status?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(StatusExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(SourceType?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(SourceTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Level?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(LevelExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Protocol?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(ProtocolExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(MappingResult?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(MappingResultExtensions.ReadJson(reader, serializer));
            }

            throw new Exception("Unknown type");
        }
Exemplo n.º 2
0
        public override object ReadJson(JsonReader reader, Type t, object existingValue, JsonSerializer serializer)
        {
            if (t == typeof(Level))
            {
                return(LevelExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(CoverType))
            {
                return(CoverTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(SeriesType))
            {
                return(SeriesTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Status))
            {
                return(StatusExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(SystemBackupType))
            {
                return(SystemBackupTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Protocol))
            {
                return(ProtocolExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(QualityName))
            {
                return(QualityNameExtensions.ReadJson(reader, serializer));
            }

            if (t == typeof(Level?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(LevelExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(CoverType?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(CoverTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(SeriesType?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(SeriesTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Status?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(StatusExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(SystemBackupType?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(SystemBackupTypeExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(Protocol?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(ProtocolExtensions.ReadJson(reader, serializer));
            }
            if (t == typeof(QualityName?))
            {
                if (reader.TokenType == JsonToken.Null)
                {
                    return(null);
                }
                return(QualityNameExtensions.ReadJson(reader, serializer));
            }

            throw new Exception("Unknown type");
        }