private void LoadConfig(string templatePath) { var versions = (DotnetTemplateVersion[])Enum.GetValues(typeof(DotnetTemplateVersion)); foreach (var version in versions) { var versionString = version == DotnetTemplateVersion.V2 ? "2.x" : "3.x"; var path = templatePath + Path.DirectorySeparatorChar + versionString; foreach (var dir in new DirectoryInfo(path).EnumerateDirectories()) { var mustacheTemplateSetting = new MustacheTemplateSettings(_logger, dir.FullName); _templateSettings.Add(new TemplateKey(dir.Name, version), mustacheTemplateSetting); } } }
private void LoadConfig(string templatePath) { var configs = new[] { new[] { Constants.Steeltoe24, Constants.NetCoreApp21 }, new[] { Constants.Steeltoe24, Constants.NetCoreApp31 }, new[] { Constants.Steeltoe30, Constants.NetCoreApp31 }, }; foreach (var config in configs) { var steeltoe = Regex.Match(config[0], @"(\d+\.\d+).*").Groups[1].Value; var framework = config[1]; var path = Path.Join(templatePath, steeltoe, framework); foreach (var dir in new DirectoryInfo(path).EnumerateDirectories()) { _logger.LogInformation($"Loading {dir}"); var template = dir.Name; var mustacheTemplateSetting = new MustacheTemplateSettings(_logger, dir.FullName); _templateSettings.Add(new TemplateKey(steeltoe, framework, template), mustacheTemplateSetting); } } }