예제 #1
0
        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);
        }
예제 #2
0
        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)));
            }
        }
예제 #3
0
        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);
        }
예제 #4
0
 internal IEnumerable <TomlComment> GetComments(Type type, SerializationMember m)
 => StaticTypeMetaData.GetComments(type, m);