private HashSet <string> ResolveParameter(TextResource resource) { var parameter = new HashSet <string>(); var regex = new Regex(@"{(\w+)}"); // finds all {word} constructs foreach (Match match in regex.Matches(resource.Value)) { parameter.Add(match.Groups[1].Value); } return(parameter); }
private string MethodImplementation(TextResource entry) { var sb = new StringBuilder(); var parameter = ResolveParameter(entry); foreach (var singleParameter in parameter) { sb.AppendLine($@"sb.Replace(""{{{singleParameter}}}"", {singleParameter});"); } return(sb.ToString()); }
private string PropertyMethodParameter(TextResource resource) => string.Join(", ", ResolveParameter(resource).Select(p => $"string {p}"));