示例#1
0
        public void SaveValue(IMemberInfoWrapper memberInfoWrapper, object configuration)
        {
            var value = memberInfoWrapper.GetValue(configuration);

            var defaultIniValue = new IniValue()
            {
                Section = _iniValueManager.GetSection(configuration.GetType(), memberInfoWrapper),
                Key     = _iniValueManager.GetKey(memberInfoWrapper),
            };

            var(converter, defaultConverter, typeDetailsInformation) = _iniConverterFactory.GetConverter(memberInfoWrapper.GetMemberType(), value, memberInfoWrapper);

            var iniContext = new IniContext(memberInfoWrapper, typeDetailsInformation, defaultIniValue, _iniParser, defaultConverter);

            var valueToSave = converter.FormatToWrite(value, iniContext);

            if (valueToSave?.Value == null)
            {
                return;
            }

            _iniParser.Write(valueToSave.Section, valueToSave.Key, valueToSave.Value);
        }
 public object GetValue(object configuration)
 {
     return(_infoWrapper.GetValue(configuration));
 }