Esempio n. 1
0
 public void Add(string flag, bool activated)
 {
     try
     {
         primarySource.Add(flag, FlagParameter.CreateEmpty(activated));
     }
     catch (FlagSourceException e)
     {
         circuitBreaker.SetFail();
         throw e;
     }
 }
Esempio n. 2
0
        public void Load(string content)
        {
            var flags = JsonConvert.DeserializeObject <IDictionary <string, IDictionary <string, object> > >(content);

            foreach (var key in flags.Keys)
            {
                var value     = flags[key]["Conditions"];
                var activated = Convert.ToBoolean(flags[key]["Activated"]);

                if (value == null)
                {
                    primarySource.Add(key, FlagParameter.CreateEmpty(activated));
                    readOnlySource.Add(key, FlagParameter.CreateEmpty(activated));
                }
                else
                {
                    primarySource.Add(key, FlagParameter.CreateFromObject(value, activated));
                    readOnlySource.Add(key, FlagParameter.CreateFromObject(value, activated));
                }
            }
        }