Пример #1
0
        public override bool hasMatch(ISerializableContainer container)
        {
            if (sortedFieldInfo.Value.ContainsKey(container.SerializedName))
            {
                if (SerializedTypeManipulator.isInterfaceCollectionType(sortedFieldInfo.Value[container.SerializedName].Type()))
                {
                    if (sortedFieldInfo.Value[container.SerializedName].Type().IsGenericType)                     //if true then it's something like IEnumerable<ISomething>
                    {
                        if (container.SerializedType == sortedFieldInfo.Value[container.SerializedName].Type().GetGenericArguments().First())
                        {
                            return(true);
                        }
                    }
                    else
                    {
                        //It could still be an array. Those aren't considered generic
                        if (sortedFieldInfo.Value[container.SerializedName].Type().IsArray)
                        {
                            if (container.SerializedType == sortedFieldInfo.Value[container.SerializedName].Type().GetElementType())
                            {
                                return(true);
                            }
                        }
                    }
                }
            }

            return(false);
        }
Пример #2
0
        public override FieldInfo FindMatch(ISerializableContainer container)
        {
            //if we find an exact matching field then we return it as the match
            if (hasMatch(container))
            {
                return(sortedFieldInfo.Value[container.SerializedName]);
            }

            return(null);
        }
        public override bool hasMatch(ISerializableContainer container)
        {
            if (sortedFieldInfo.Value.ContainsKey(container.SerializedName))
            {
                if (!SerializedTypeManipulator.isInterfaceCollectionType(sortedFieldInfo.Value[container.SerializedName].Type())) //make sure it's NOT
                {
                    if (sortedFieldInfo.Value[container.SerializedName].Type() == container.SerializedType)                       //if true then it's something like IEnumerable<ISomething>
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        public override bool hasMatch(ISerializableContainer container)
        {
            if (sortedFieldInfo.Value.ContainsKey(container.SerializedName))
            {
                if (!SerializedTypeManipulator.isInterfaceCollectionType(sortedFieldInfo.Value[container.SerializedName].Type()))               //make sure it's NOT something like IEnumerable<ISomething>
                {
                    if (container.SerializedTypeName.Contains(sortedFieldInfo.Value[container.SerializedName].Type().Name))                     //makes sure the Type is still approximately the same
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #5
0
 public abstract bool hasMatch(ISerializableContainer container);
Пример #6
0
 public abstract FieldInfo FindMatch(ISerializableContainer container);