Updated StringTemplate 4 code

Ported changes in the reference Java code over to the C# library.