Exemplo n.º 1
0
 public void Write(T item)
 {
     Init();
     foreach (string name in _Names)
     {
         RegistryAttribute _key = _Keys[name];
         if (!_key.ReadOnly)
         {
             Registry.SetValue(_key.Key, _key.Name, _Properties[name].GetValue(item));
         }
     }
 }
Exemplo n.º 2
0
        public T Read()
        {
            Init();
            T _retval = new T();

            foreach (string name in _Names)
            {
                RegistryAttribute _key   = _Keys[name];
                object            _value = Registry.GetValue(_key.Key, _key.Name, _Properties[name].GetValue(_retval));
                bool   _succes;
                object _converted = Convert(_value, _Properties[name].PropertyType, out _succes);
                if (_succes && _value != null)
                {
                    _Properties[name].SetValue(_retval, _converted);
                }
            }
            return(_retval);
        }