Exemplo n.º 1
0
        /// <inheritdoc cref="Config(HoconValue)" />
        /// <param name="source">The root node to base this configuration.</param>
        /// <exception cref="T:System.ArgumentNullException">"The root value cannot be null."</exception>
        public Config(HoconRoot source)
        {
            Value = (HoconValue)source.Value.Clone(null);
            if (!(source is Config cfg))
            {
                return;
            }

            foreach (var value in cfg._fallbacks)
            {
                _fallbacks.Add((HoconValue)value.Clone(null));
            }
        }
Exemplo n.º 2
0
        /// <inheritdoc cref="Config(HoconValue)" />
        /// <param name="root">The root node to base this configuration.</param>
        /// <exception cref="T:System.ArgumentNullException">"The root value cannot be null."</exception>
        public Config(HoconRoot root)
        {
            Value = (HoconValue)root.Value.Clone(null);
            Root  = (HoconValue)root.Value.Clone(null);

            if (!(root is Config cfg))
            {
                return;
            }

            foreach (var value in cfg._fallbacks)
            {
                InsertFallbackValue(value);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Generates a configuration defined in the supplied
        ///     HOCON (Human-Optimized Config Object Notation) string.
        /// </summary>
        /// <param name="hocon">A string that contains configuration options to use.</param>
        /// <param name="includeCallback">callback used to resolve includes</param>
        /// <returns>The configuration defined in the supplied HOCON string.</returns>
        public static Config ParseString(string hocon, HoconIncludeCallbackAsync includeCallback)
        {
            HoconRoot res = HoconParser.Parse(hocon, includeCallback);

            return(new Config(res));
        }
Exemplo n.º 4
0
 /// <inheritdoc cref="Config()"/>
 /// <param name="source">The configuration to use as the primary source.</param>
 /// <param name="fallback">The configuration to use as a secondary source.</param>
 /// <exception cref="ArgumentNullException">The source configuration cannot be null.</exception>
 public Config(HoconRoot source, Config fallback) : base(source?.Value, source?.Substitutions ?? Enumerable.Empty <HoconSubstitution>())
 {
     Fallback = fallback;
 }
Exemplo n.º 5
0
 /// <inheritdoc cref="Config()"/>
 /// <param name="root">The root node to base this configuration.</param>
 /// <exception cref="T:System.ArgumentNullException">"The root value cannot be null."</exception>
 public Config(HoconRoot root) : base(root?.Value, root?.Substitutions ?? Enumerable.Empty <HoconSubstitution>())
 {
 }
Exemplo n.º 6
0
 /// <inheritdoc cref="Config(HoconValue)" />
 /// <param name="source">The configuration to use as the primary source.</param>
 /// <param name="fallback">The configuration to use as a secondary source.</param>
 /// <exception cref="ArgumentNullException">The source configuration cannot be null.</exception>
 public Config(HoconRoot source, Config fallback) : this(source)
 {
     MergeConfig(fallback);
 }
Exemplo n.º 7
0
 /// <inheritdoc cref="Config(HoconValue)" />
 /// <param name="root">The configuration to use as the primary source.</param>
 /// <param name="fallback">The configuration to use as a secondary source.</param>
 /// <exception cref="ArgumentNullException">The source configuration cannot be null.</exception>
 public Config(HoconRoot root, Config fallback) : this(root)
 {
     MergeConfig(fallback);
 }