Ejemplo n.º 1
0
        public void Set(FormDataName name, string value)
        {
            var child = GetChild(name.Name);

            if (name.IsLeaf)
            {
                child.Value = value;
                return;
            }
            child.Set(name.Child, value);
        }
Ejemplo n.º 2
0
 private FormDataName(FormDataName parent, IList <string> parts)
 {
     Parent    = parent;
     Name      = parts[0];
     IsIndexed = Regex.IsMatch(Name, @"^[\S]+\[\S+\]$");
     Index     = Regex.Match(Name, @"\[(\S+)\]").Groups[1].Value;
     parts.RemoveAt(0);
     if (parts.Any())
     {
         Child = new FormDataName(this, parts);
     }
 }
Ejemplo n.º 3
0
        public void Add(KeyValuePair <string, string> keyValue)
        {
            var key  = keyValue.Key;
            var name = FormDataName.Parse(key);
            var node = GetOrCreate(name.Name);

            if (name.IsLeaf)
            {
                node.Value = keyValue.Value;
                return;
            }
            node.Set(name.Child, keyValue.Value);
        }