public static string Replace(this string template, MessageData data, string contextName) { return(template .Replace(contextName) .Replace("${MessageType}", data.GetTypeName()) .Replace("${MessageName}", data.MessageName()) .Replace("${messageName}", data.MessageName().LowercaseFirst()) // .Replace("${validComponentName}", data.ComponentNameValidLowercaseFirst()) // .Replace("${prefixedComponentName}", data.PrefixedComponentName()) .Replace("${newMethodParameters}", GetMethodParameters(data.GetMemberData(), true)) // .Replace("${methodParameters}", GetMethodParameters(data.GetMemberData(), false)) // .Replace("${newMethodArgs}", GetMethodArgs(data.GetMemberData(), true)) // .Replace("${methodArgs}", GetMethodArgs(data.GetMemberData(), false)) .Replace("${Index}", contextName + LOOKUP_MESSAGE + "." + data.MessageName())); }
CodeGenFile generate(string contextName, MessageData data) { var template = STANDARD_TEMPLATE; var fileContent = template .Replace("${memberAssignmentList}", getMemberAssignmentList(data.GetMemberData())) .Replace(data, contextName); return(new CodeGenFile( contextName + Path.DirectorySeparatorChar + "Messages" + Path.DirectorySeparatorChar + data.MessageNameWithContext(contextName).AddMessageSuffix() + ".cs", fileContent, GetType().FullName )); }