public ConfigurationDictionary(IConfigurationDictionary dict)
 {
     foreach (string key in dict.GetKeys())
     {
         this.Add(key, dict[key]);
     }
 }
Exemple #2
0
        private async Task <Tool> ConfigureAndStartAsync(Tool tool, IConfigurationDictionary configurationDictionary)
        {
            var configurer = new LineByLineConfigurer(configurationDictionary, new ConfigurationFormat());
            await configurer.ApplySettings(tool.ConfigurationPath, _settings).ConfigureAwait(false);

            await _toolRunner.StartAsync(tool).ConfigureAwait(false);

            return(tool);
        }
        public ConfigurationBase(IConfigurationDictionary configSettings)
        {
            _configSettings = configSettings;
            var properties = this.GetType().GetProperties(BindingFlags.Instance | System.Reflection.BindingFlags.Public);

            foreach (var p in properties)
            {
                UpdateProperty(p);
            }
        }
Exemple #4
0
        public override void WriteJson(global::Newtonsoft.Json.JsonWriter writer, [AllowNull] IConfigurationDictionary <TElement> value, global::Newtonsoft.Json.JsonSerializer serializer)
        {
            if (ReferenceEquals(value, null))
            {
                writer.WriteNull();
                return;
            }

            writer.WriteStartObject();

            foreach (var item in value)
            {
                writer.WritePropertyName(item.Key);
                serializer.Serialize(writer, item.Value);
            }

            writer.WriteEndObject();
        }
        /// <summary>
        ///     Writes the specifiedvalue to the writer given.
        /// </summary>
        /// <param name="writer">
        ///     The JSON writer with which to record data.
        /// </param>
        /// <param name="dictionary">
        ///     The dictionary from which to read data.
        /// </param>
        /// <param name="options">
        ///     The options govenerning how the JSON is to be formatted.
        /// </param>
        public override void Write(Utf8JsonWriter writer, IConfigurationDictionary <TElement> dictionary, JsonSerializerOptions options)
        {
            writer.WriteStartObject();

            foreach (var kvp in dictionary)
            {
                writer.WritePropertyName(kvp.Key.ToString());

                if (_valueConverter != null)
                {
                    _valueConverter.Write(writer, kvp.Value, options);
                }
                else
                {
                    JsonSerializer.Serialize(writer, kvp.Value, options);
                }
            }

            writer.WriteEndObject();
        }
Exemple #6
0
 public WorkingConfig(IConfigurationDictionary configSettings) : base(configSettings)
 {
 }
Exemple #7
0
 public UnparsableValueConfig(IConfigurationDictionary configSettings) : base(configSettings)
 {
 }
Exemple #8
0
 public MissingValueConfig(IConfigurationDictionary configSettings) : base(configSettings)
 {
 }
 private async Task<Tool> ConfigureAndStartAsync(Tool tool, IConfigurationDictionary configurationDictionary)
 {
     var configurer = new LineByLineConfigurer(configurationDictionary, new ConfigurationFormat());
     await configurer.ApplySettings(tool.ConfigurationPath, _settings).ConfigureAwait(false);
     await _toolRunner.StartAsync(tool).ConfigureAwait(false);
     return tool;
 }
Exemple #10
0
 public LineByLineConfigurer(IConfigurationDictionary configurationDictionary, IConfigurationFormat format)
 {
     _configurationDictionary = configurationDictionary;
     _format = format;
 }
 public LineByLineConfigurer(IConfigurationDictionary configurationDictionary, IConfigurationFormat format)
 {
     _configurationDictionary = configurationDictionary;
     _format = format;
 }
Exemple #12
0
 public override IConfigurationDictionary <TElement> ReadJson(global::Newtonsoft.Json.JsonReader reader, Type objectType, [AllowNull] IConfigurationDictionary <TElement> existingValue, bool hasExistingValue, global::Newtonsoft.Json.JsonSerializer serializer)
 {
     throw new NotImplementedException();
 }
 public ConfigurationBuilder(IConfigurationOptions options)
 {
     Options = options ?? throw new ArgumentNullException(nameof(options));
     ConfigurationDictionary = new ConfigurationDictionary <TMemberOptionsBuilder, TMemberOptions>();
     InitAllMembers();
 }