public static void Preprocess(Stream input, Stream output, IDictionary<string, string> parameters) { string text; using (var streamReader = new StreamReader(input)) { text = streamReader.ReadToEnd(); } var tokenizer = new PPFileTokenizer(text); using (var streamWriter = new StreamWriter(output)) { while (true) { var token = tokenizer.Read(); if (token == null) { break; } if (token.Category == PPFileTokenizer.TokenCategory.Variable) { var replaced = ReplaceToken(token.Value, parameters); streamWriter.Write(replaced); } else { streamWriter.Write(token.Value); } } } }
public static void Preprocess(Stream input, Stream output, IDictionary <string, string> parameters) { string text; using (var streamReader = new StreamReader(input)) { text = streamReader.ReadToEnd(); } var tokenizer = new PPFileTokenizer(text); using (var streamWriter = new StreamWriter(output)) { while (true) { var token = tokenizer.Read(); if (token == null) { break; } if (token.Category == PPFileTokenizer.TokenCategory.Variable) { var replaced = ReplaceToken(token.Value, parameters); streamWriter.Write(replaced); } else { streamWriter.Write(token.Value); } } } }