public IniContext(IMemberInfoWrapper memberInfoWrapper, TypeDetailsInformation typeDetailsInformation, IniValue iniValue, IIniParser iniParser, IIniConverter defaultConverter) { MemberInfoWrapper = memberInfoWrapper; TypeDetailsInformation = typeDetailsInformation; IniValue = iniValue; IniParser = iniParser; DefaultConverter = defaultConverter; }
private IIniConverter GetHandler(TypeDetailsInformation typeInformation) { switch (typeInformation.TypeCode) { case TypeCode.Dictionary: { var underlyingTypeHandler = GetBaseHandler(typeInformation.UnderlyingTypeInformation.TypeCode, typeInformation.UnderlyingTypeInformation.IsEnum); var underlyingKeyTypeHandler = GetBaseHandler(typeInformation.UnderlyingKeyTypeInformation.TypeCode, typeInformation.UnderlyingKeyTypeInformation.IsEnum); return(new DictionaryConverter(underlyingTypeHandler, underlyingKeyTypeHandler, new ReadSectionsParser())); } case TypeCode.Enumerable: { if (typeInformation.UnderlyingTypeInformation?.TypeCode == TypeCode.ComplexObject) { return(new EnumerableComplexTypesConverter(IniWrapperWithCustomMemberInfo)); } var underlyingTypeHandler = GetBaseHandler(typeInformation.UnderlyingTypeInformation.TypeCode, typeInformation.UnderlyingTypeInformation.IsEnum); return(new EnumerableConverter(underlyingTypeHandler, _iniSettings)); } case TypeCode.NullValue: { if (_iniSettings.NullValueHandling == NullValueHandling.Ignore) { return(new NullValueConverter()); } if (typeInformation.UnderlyingTypeInformation?.TypeCode == TypeCode.ComplexObject) { return(new NullComplexTypeConverter(new ComplexTypeConverter(IniWrapper))); } return(new NullValueReplaceConverter()); } default: { return(GetBaseHandler(typeInformation.TypeCode, typeInformation.UnderlyingTypeInformation?.IsEnum)); } } }
private IIniConverter GetHandlerWithIgnoreAttributeHandlerDecorator(TypeDetailsInformation typeInformation, IMemberInfoWrapper memberInfoWrapper) { return(new IgnoreAttributeConverter(GetHandler(typeInformation), memberInfoWrapper)); }