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.
Lidarr/src/NzbDrone.SignalR/SignalRContractResolver.cs

29 lines
890 B

using System;
using Newtonsoft.Json.Serialization;
namespace NzbDrone.SignalR
{
public class SignalRContractResolver : IContractResolver
{
private readonly IContractResolver _camelCaseContractResolver;
private readonly IContractResolver _defaultContractSerializer;
public SignalRContractResolver()
{
_defaultContractSerializer = new DefaultContractResolver();
_camelCaseContractResolver = new CamelCasePropertyNamesContractResolver();
}
public JsonContract ResolveContract(Type type)
{
var fullName = type.FullName;
if (fullName.StartsWith("NzbDrone") || fullName.StartsWith("Lidarr"))
{
return _camelCaseContractResolver.ResolveContract(type);
}
return _defaultContractSerializer.ResolveContract(type);
}
}
}