public Image(int edit, string id, IThumbnails thumbnails, CoverArtType types) { this.Edit = edit; this.Id = id; this.Thumbnails = thumbnails; this.Types = types; }
/// <inheritdoc /> protected override IList <JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization) { IList <JsonProperty> properties = base.CreateProperties(type, memberSerialization); if (!type.IsAssignableTo(typeof(IThumbnails))) { return(properties); } foreach ((int id, string image) in Images.ImageName) { properties.Add(new JsonProperty { DeclaringType = type, PropertyName = image.ToLower(), UnderlyingName = image, PropertyType = typeof(string), Readable = true, Writable = false, ItemIsReference = false, TypeNameHandling = TypeNameHandling.None, ShouldSerialize = x => { IThumbnails thumb = (IThumbnails)x; return(thumb?.Images?.ContainsKey(id) == true); }, ValueProvider = new ThumbnailProvider(_options.Value.PublicUrl, id) }); } return(properties); }