コード例 #1
0
 public void Add(string flag, bool activated)
 {
     try
     {
         primarySource.Add(flag, FlagParameter.CreateEmpty(activated));
     }
     catch (FlagSourceException e)
     {
         circuitBreaker.SetFail();
         throw e;
     }
 }
コード例 #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));
                }
            }
        }
コード例 #3
0
 public void Add <T>(string flag, T parameter, bool activated)
 {
     try
     {
         if (IsList(parameter))
         {
             primarySource.Add(flag, FlagParameter.CreateFromObject(parameter, activated));
         }
         else
         {
             primarySource.Add(flag, FlagParameter.CreateFromObject(new List <T> {
                 parameter
             }, activated));
         }
     }
     catch (FlagSourceException e)
     {
         circuitBreaker.SetFail();
         throw e;
     }
 }