public CakeConfiguration(IOmniSharpEnvironment environment, ILoggerFactory loggerFactory) { _lookup = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); // Parse the configuration file. var configurationPath = Path.Combine(environment.TargetDirectory, "cake.config"); if (File.Exists(configurationPath)) { try { var parser = new ConfigurationParser(); var configuration = parser.Read(configurationPath); foreach (var key in configuration.Keys) { _lookup[KeyNormalizer.Normalize(key)] = configuration[key]; } } catch (Exception ex) { loggerFactory .CreateLogger <CakeConfiguration>() .LogError(ex, "Error occured while parsing Cake configuration."); } } }
public string GetValue(string key) { key = KeyNormalizer.Normalize(key); return(_lookup.ContainsKey(key) ? _lookup[key] : null); }