public T GetAttribute <T>() where T : System.Attribute
        {
            if (typeof(IniOptionsAttribute).IsAssignableFrom(typeof(T)))
            {
                return((T)(System.Attribute)_dynamicIniOptionsAttribute);
            }

            return(_infoWrapper.GetAttribute <T>());
        }
        public (IIniConverter converter, IIniConverter defaultHandler, TypeDetailsInformation typeDetailsInformation) GetConverter(Type type, object value, IMemberInfoWrapper memberInfoWrapper)
        {
            var typeInformation = _typeManager.GetTypeInformation(type, value, memberInfoWrapper);

            var customIniHandlerAttribute = memberInfoWrapper.GetAttribute <IniConverterAttribute>();

            if (customIniHandlerAttribute != null)
            {
                var customHandler = CreateCustomConverter(customIniHandlerAttribute);

                var handlerWithDecorator = GetHandlerWithIgnoreAttributeHandlerDecorator(typeInformation, memberInfoWrapper);
                return(customHandler, handlerWithDecorator, typeInformation);
            }

            var handlerWithIgnoreAttributeHandlerDecorator = GetHandlerWithIgnoreAttributeHandlerDecorator(typeInformation, memberInfoWrapper);

            return(handlerWithIgnoreAttributeHandlerDecorator, null, typeInformation);
        }
Exemple #3
0
        public object ParseReadValue(string readValue, Type destinationType, IniContext iniContext)
        {
            var ignoreAttribute = _memberInfoWrapper.GetAttribute <IniIgnoreAttribute>();

            return(ignoreAttribute == null?_iniConverter.ParseReadValue(readValue, destinationType, iniContext) : null);
        }
        public string GetKey(IMemberInfoWrapper memberInfoWrapper)
        {
            var iniOptionsAttribute = memberInfoWrapper.GetAttribute <IniOptionsAttribute>();

            return(iniOptionsAttribute?.Key);
        }
        public string GetSection(Type destinationType, IMemberInfoWrapper memberInfoWrapper)
        {
            var iniOptionsAttribute = memberInfoWrapper.GetAttribute <IniOptionsAttribute>();

            return(iniOptionsAttribute?.Section);
        }