public static void Main(string[] args) { IThaiSyllabifier breaker = null; breaker = BreakerFactoryMethod(args); // This will hold the output HTML text. StringBuilder htmlOutput = new StringBuilder(); // Say hello. EmitHelloMessage(htmlOutput); // Emit the opening <html>, <meta/> and opening <body> tags. htmlOutput.Append("<html><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /><body>"); // Now loop over each line in the input file and write it out. foreach (var currLine in File.ReadAllLines(inputFileLocation)) { breaker.SyllabifyString(currLine); htmlOutput.Append(breaker.GetOutputString()); htmlOutput.Append("<br/>"); } // Emit the closing message / tags. EmitClosingMessage(htmlOutput); htmlOutput.Append("</body></html>"); // Dump to file. File.WriteAllText("myOutput.html", htmlOutput.ToString()); Console.WriteLine("Please load myOutput.html into a web browser to see program results."); }
static IThaiSyllabifier BreakerFactoryMethod(string[] args) { // See if user wants to use lambda version. if (args.Contains("-lambda")) { usingLambda = true; } // Create the buster. IThaiSyllabifier breaker = null; if (!usingLambda) { breaker = new ThaiSyllabifierCaseLogic(); } else { breaker = new ThaiSyllabifierLambdaLogic(); } return(breaker); }