Exemplo n.º 1
0
        private List <Option> MergeOptions(
            EngineOptions configOptions,
            EngineSpecification specification)
        {
            var sortedOptions = new List <Option>();

            foreach (var option in specification.OptionsSchema)
            {
                var    key = option.Key;
                string value;
                if (option.Value.Id == "{path}")
                {
                    value = option.Value.Id;
                }
                else
                {
                    value = configOptions.GetValueOrDefault(key) ??
                            specification.Schema.Defaults.GetValueOrDefault(key);
                }

                if (value != null || (option.Value.Type == "null" && specification.Schema.Defaults.ContainsKey(key)))
                {
                    sortedOptions.Add(new Option(key, value));
                }
            }

            return(sortedOptions);
        }