internal SerializationMember?TryGetMappedMember(Type t, string key) { var configured = StaticTypeMetaData.GetSerializationMembers(t, this.keyGenerator) .Concat(this.explicitMembers.Forward.Keys); var cmem = configured.Where(IsFlup) .Cast <SerializationInfo?>() .FirstOrDefault(); bool IsFlup(SerializationInfo si) { bool r = si.Key.Value == key; return(r); } if (cmem.HasValue && !this.IsMemberIgnored(t, cmem.Value.Member.MemberInfo)) { return(cmem.Value.Member); } var pi = this.mappingPropertySelector.TryGetTargetProperty(key, t); return(pi != null && !this.IsMemberIgnored(t, pi) ? new SerializationMember(pi) : (SerializationMember?)null); }
internal IEnumerable <SerializationInfo> GetSerializationMembers(Type t) { return(StaticTypeMetaData.GetSerializationMembers(t, this.keyGenerator) .Where(si => IncludeMember(si.Member.MemberInfo)) .Concat(this.explicitMembers.Forward.Keys)); bool IncludeMember(MemberInfo mi) { return(!this.IsMemberIgnored(t, mi) && !this.explicitMembers.Forward.Keys.Any(si => si.Is(mi))); } }
private bool IsMemberIgnored(Type ownerType, MemberInfo mi) { Assert(ownerType != null); Assert(mi != null); if (StaticTypeMetaData.IsMemberIgnored(ownerType, mi)) { return(true); } if (this.ignoredMembers.TryGetValue(ownerType, out var ignored)) { return(ignored.Any(m => m.Is(mi))); } return(false); }
internal IEnumerable <TomlComment> GetComments(Type type, SerializationMember m) => StaticTypeMetaData.GetComments(type, m);