Ejemplo n.º 1
0
        void SerializeSetting(string name, IConfigurationNode configurationNode, JObject json)
        {
            // name  has sub-key
            if (name.Contains(":"))
            {
                var prefix = name.Split(':').First();

                // get or create the inner json object for the sub-keys
                var innerJson = json[prefix] as JObject;
                if (innerJson == null)
                {
                    innerJson    = new JObject();
                    json[prefix] = innerJson;
                }

                // serialize setting (remove prefix from name)
                var newName = name.Remove(0, prefix.Length + 1);
                SerializeSetting(newName, new PrefixConfigurationNode(configurationNode, prefix), innerJson);
            }
            // no subkeys => write setting to current json object
            else
            {
                var value = configurationNode.GetValue(name);
                json[name] = value;
            }
        }
Ejemplo n.º 2
0
 protected override T HandleMissingValue <T>(string name)
 {
     // if we have a parent node, request the setting from there
     if (m_ParentNode != null)
     {
         return(m_ParentNode.GetValue <T>(name));
     }
     throw new KeyNotFoundException($"No value found for name '{name}'");
 }
Ejemplo n.º 3
0
 public string GetValue(string name) => m_WrappedConfigurationNode.GetValue(name);
Ejemplo n.º 4
0
 public string GetValue(string name) => m_WrappedConfigurationNode.GetValue(GetPrefixedName(name));