Ejemplo n.º 1
0
        private static void ParseArray(JArray json, CustomConfigurationValue customConfiguration)
        {
            foreach (var element in json)
            {
                var configValue = new CustomConfigurationValue();
                customConfiguration.Values.Add(configValue);

                Parse(element, configValue);
            }
        }
Ejemplo n.º 2
0
        private static void ParseObject(JObject json, CustomConfigurationValue customConfiguration)
        {
            foreach (var child in json.Children())
            {
                var property    = (JProperty)child;
                var configValue = new CustomConfigurationValue {
                    Key = property.Name
                };
                customConfiguration.Values.Add(configValue);

                Parse(property.Value, configValue);
            }
        }
Ejemplo n.º 3
0
 private static void Parse(JToken jsonToken, CustomConfigurationValue customConfiguration)
 {
     if (jsonToken is JObject)
     {
         ParseObject((JObject)jsonToken, customConfiguration);
     }
     else if (jsonToken is JArray)
     {
         ParseArray((JArray)jsonToken, customConfiguration);
     }
     else
     {
         ParseToken(jsonToken, customConfiguration);
     }
 }
Ejemplo n.º 4
0
 private static void ParseToken(JToken json, CustomConfigurationValue customConfiguration)
 {
     customConfiguration.Value = json.Value <string>();
 }
Ejemplo n.º 5
0
 public JsonCustomConfiguration(JObject jsonObject)
 {
     _value = new CustomConfigurationValue();
     Parse(jsonObject, _value);
 }