Exemple #1
0
        public void SyncTo(ISettingsValuesContainer mem = null)
        {
            if (mem == null)
            {
                mem = _settings;
            }
            StringBuilder bdr = new StringBuilder();

            foreach (var item in _items)
            {
                bdr.AppendFormat("{0}:{1};", item.Key, item.Value.Cypher());
            }

            mem.SettingsValues = bdr.ToString();
        }
Exemple #2
0
        public SettingsAccessor(ISettingsValuesContainer settings)
        {
            _settings = settings;

            //não vai se usar settings names
            string[] sts = (settings.SettingsValues ?? "").Split(';');

            foreach (var items in sts)
            {
                string key   = null;
                string value = null;
                try
                {
                    if (!string.IsNullOrEmpty(items))
                    {
                        var tuple = items.Split(':');
                        key   = tuple[0];
                        value = tuple[1].Decypher();//constroi o valor no padrão
                        _items.Add(key, value);
                    }
                }
                catch { continue; }
            }
        }