public virtual void ReadFrom(XElement xE) { Impressions = null; TimeUnit = null; Level = null; foreach (var xItem in xE.Elements()) { var localName = xItem.Name.LocalName; if (localName == "impressions") { Impressions = long.Parse(xItem.Value); } else if (localName == "timeUnit") { TimeUnit = TimeUnitExtensions.Parse(xItem.Value); } else if (localName == "level") { Level = LevelExtensions.Parse(xItem.Value); } } }
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"); }
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"); }