public IEnumerable <IService> GetServices() { string json = File.ReadAllText(launcherConfigFileName); LauncherConfiguration config = JsonConvert.DeserializeObject <LauncherConfiguration>(json); IReadOnlyDictionary <string, string> variables = GetVariables(config); foreach (LauncherConfiguration.ServiceConfiguration service in config.Services) { yield return(GetService(service, variables)); } }
private IReadOnlyDictionary <string, string> GetVariables(LauncherConfiguration config) { Dictionary <string, string> result = new Dictionary <string, string>() { ["File.ContainingDirectory"] = Path.GetDirectoryName(this.launcherConfigFileName) }; foreach (var item in config.Variables) { result.Add($"Variables.{item.Key}", item.Value); } return(result); }