public string GetCsvConfigString(string targetFilePath, string templateName) { //Read a default config file var defaultConfigPath = Path.Combine(Path.GetDirectoryName(targetFilePath), "Default.config.csx"); if (File.Exists(defaultConfigPath)) { var configText = File.ReadAllText(defaultConfigPath, Encoding.UTF8); CurrentConfigFilePath = defaultConfigPath; return(configText); } //Read a config file from selected template. if (SettingsList.Skip(1).Contains(templateName)) { var templateFilePath = Path.Combine(ConfigFileDirectory, templateName + ".config.csx"); if (!File.Exists(templateFilePath)) { return($"Error! \"{templateFilePath}\" is not found."); } var configText = File.ReadAllText(templateFilePath, Encoding.UTF8); CurrentConfigFilePath = templateFilePath; return(configText); } //Generate a new config template. if (true != _dialogService.ShowModal()) { return(""); } var configFileSettings = _dialogService.Result; return(GenerateCsvConfig(targetFilePath, configFileSettings)); }