public bool CanMarshal(Type type)
        {
            if (!type.IsEnum)
            {
                return(false);
            }
            Type underlyingType = Enum.GetUnderlyingType(type);

            return(MarshalingManager.IsKnownType(underlyingType));
        }
Exemplo n.º 2
0
        public bool CanMarshal(Type type)
        {
            if (!IsList(type))
            {
                return(false);
            }
            Type elementType = type.GetProperty("Item").PropertyType;

            return(MarshalingManager.IsKnownType(elementType));
        }
Exemplo n.º 3
0
        public bool CanMarshal(Type type)
        {
            if (!type.IsArray)
            {
                return(false);
            }
            Type elementType = type.GetElementType();

            return(MarshalingManager.IsKnownType(elementType));
        }
Exemplo n.º 4
0
        public void MarshalObject(object value, Stream stream)
        {
            IList list = (IList)value;

            Int32Marshaler.Marshal(list.Count, stream);
            foreach (object element in list)
            {
                MarshalingManager.Marshal(element, stream);
            }
        }
        public bool TryCreate(Type type, out ITypeMarshaler typeMarshaler)
        {
            if (!IsUniqueSettingsCollection(type) || type.IsAbstract)
            {
                typeMarshaler = null;
                return(false);
            }
            Type           elementType      = GetSettingsType(type);
            ITypeMarshaler elementMarshaler = MarshalingManager.GetMarshaler(elementType);

            typeMarshaler = new UniqueSettingsCollectionMarhaler(type, elementMarshaler);
            return(true);
        }
        public bool TryCreate(Type type, out ITypeMarshaler typeMarshaler)
        {
            if (!type.IsEnum)
            {
                typeMarshaler = null;
                return(false);
            }
            Type           underlyingType      = Enum.GetUnderlyingType(type);
            ITypeMarshaler underlyingMarshaler = MarshalingManager.GetMarshaler(underlyingType);

            if (underlyingMarshaler == null)
            {
                typeMarshaler = null;
                return(false);
            }
            typeMarshaler = new EnumMarshaler(type, underlyingMarshaler);
            return(true);
        }
Exemplo n.º 7
0
        public bool TryCreate(Type type, out ITypeMarshaler typeMarshaler)
        {
            if (!IsList(type))
            {
                typeMarshaler = null;
                return(false);
            }
            Type           elementType      = type.GetProperty("Item").PropertyType;
            ITypeMarshaler elementMarshaler = MarshalingManager.GetMarshaler(elementType);

            if (elementMarshaler == null)
            {
                typeMarshaler = null;
                return(false);
            }
            typeMarshaler = new ListMarshaler(type, elementMarshaler);
            return(true);
        }
Exemplo n.º 8
0
        public bool TryCreate(Type type, out ITypeMarshaler typeMarshaler)
        {
            if (!type.IsArray)
            {
                typeMarshaler = null;
                return(false);
            }
            Type           elementType      = type.GetElementType();
            ITypeMarshaler elementMarshaler = MarshalingManager.GetMarshaler(elementType);

            if (elementMarshaler == null)
            {
                typeMarshaler = null;
                return(false);
            }
            typeMarshaler = new ArrayMarshaler(type, elementMarshaler);
            return(true);
        }