Exemplo n.º 1
0
        public override object ConvertBack([NotNull] IEnumerable <string> target)
        {
            _listBuilder.Begin(null, false);

            foreach (var content in target)
            {
                _listBuilder.Add(_baseConverter.ConvertBack(content));
            }

            return(Argument.CheckResult(_listBuilder.End(), "List Builder Result"));
        }
Exemplo n.º 2
0
        protected override void Deserialize(object target, IniContext context)
        {
            Argument.NotNull(context, nameof(context));

            var temp = context.File[_section]?.GetListEntry(_key)?.Values;

            if (temp == null)
            {
                return;
            }

            var value = _converter?.ConvertBack(temp);

            SetValue(target, value);
        }
        private void ProgressString(SerializerMode mode, ref string str, ref object?obj)
        {
            switch (mode)
            {
            case SerializerMode.Deserialize:
                obj = _converter?.ConvertBack(str);
                break;

            case SerializerMode.Serialize:
                str = _converter?.Convert(obj) ?? string.Empty;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode));
            }
        }
        protected override void Deserialize(object target, HeaderdFileContext context)
        {
            Argument.NotNull(context, nameof(context));

            if (string.IsNullOrEmpty(_keyName))
            {
                return;
            }

            _listBuilder?.Begin(null, false);

            try
            {
                foreach (var contextEnry in context.Context[_keyName])
                {
                    _listBuilder?.Add(_converter?.ConvertBack(contextEnry.Content));
                }
            }
            finally
            {
                SetValue(target, _listBuilder?.End());
            }
        }
Exemplo n.º 5
0
 protected override void Deserialize(object target, HeaderdFileContext context)
 {
     SetValue(target, _converter?.ConvertBack(Argument.NotNull(context, nameof(context)).Content));
 }
Exemplo n.º 6
0
        protected override void Deserialize(object target, HeaderdFileContext context)
        {
            var entry = context.Context[_keyName].First();

            SetValue(target, _converter?.ConvertBack(entry.Content));
        }
        protected override void Deserialize(object target, IniContext context)
        {
            var value = _converter?.ConvertBack(context.File[_section]?.GetSingleEntry(_key)?.Value ?? string.Empty);

            SetValue(target, value);
        }