mirror of
https://github.com/tribufu/ServerGridEditor
synced 2026-05-06 15:17:35 +00:00
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Serialization;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AtlasGridDataLibrary
|
|
{
|
|
public class DeploymentAttribute : Attribute
|
|
{
|
|
}
|
|
|
|
public class DeploymentOverrideAttribute : DeploymentAttribute
|
|
{
|
|
}
|
|
public class DeploymentConstAttribute : DeploymentAttribute
|
|
{
|
|
}
|
|
|
|
|
|
public class DeploymentOverrideShouldSerializeContractResolver : DefaultContractResolver
|
|
{
|
|
//public new static readonly ShouldSerializeContractResolver Instance = new ShouldSerializeContractResolver();
|
|
|
|
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
|
|
{
|
|
JsonProperty property = base.CreateProperty(member, memberSerialization);
|
|
|
|
bool bShouldSersialize = member.GetCustomAttributes().OfType<DeploymentAttribute>().Any();
|
|
property.ShouldSerialize =
|
|
instance =>
|
|
{
|
|
return bShouldSersialize;
|
|
};
|
|
|
|
return property;
|
|
}
|
|
}
|
|
}
|