You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/src/TrashLib/Sonarr/Api/Mappings/SonarrApiObjectMappingProfi...

28 lines
1001 B

using System;
using System.Linq;
using AutoMapper;
using JetBrains.Annotations;
using TrashLib.Sonarr.Api.Objects;
namespace TrashLib.Sonarr.Api.Mappings
{
[UsedImplicitly]
public class SonarrApiObjectMappingProfile : Profile
{
public SonarrApiObjectMappingProfile()
{
CreateMap<SonarrReleaseProfileV1, SonarrReleaseProfile>()
.ForMember(d => d.Ignored, x => x.MapFrom(
s => s.Ignored.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList()))
.ForMember(d => d.Required, x => x.MapFrom(
s => s.Required.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList()));
CreateMap<SonarrReleaseProfile, SonarrReleaseProfileV1>()
.ForMember(d => d.Ignored, x => x.MapFrom(
s => string.Join(',', s.Ignored)))
.ForMember(d => d.Required, x => x.MapFrom(
s => string.Join(',', s.Required)));
}
}
}