添加 MX-PD-盘古 项目文件
将 MX-PD-盘古 - new 目录下的所有文件添加到主仓库
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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 MainShell.Filewritable
|
||||
{
|
||||
public class IgnorePropertiesResolver : DefaultContractResolver
|
||||
{
|
||||
private readonly HashSet<string> _ignoreProps;
|
||||
public IgnorePropertiesResolver(IEnumerable<string> propNames) =>
|
||||
_ignoreProps = new HashSet<string>(propNames);
|
||||
|
||||
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
|
||||
{
|
||||
var p = base.CreateProperty(member, memberSerialization);
|
||||
if (_ignoreProps.Contains(p.PropertyName))
|
||||
p.Ignored = true;
|
||||
return p;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user