/// <summary> /// Writes the safe output file. /// </summary> /// <param name="outputFile">The output file.</param> /// <param name="data">The data.</param> /// <param name="encoding">The encoding.</param> private static void WriteSafeOutputFile(string outputFile, string data, Encoding encoding) { ILogger logger = ServiceLocator.Instance.GetService <ILogger>(); if (logger != null) { logger.Write("Writing generated file", String.Concat("Save template generation result in " + outputFile), LogType.Debug); } Directory.CreateDirectory(Path.GetDirectoryName(outputFile)); // Ecriture dans le fichier de sortie ServiceLocator.Instance.ShellHelper.EnsureCheckout(outputFile); encoding = new UTF8Encoding(false, true); using (SafeStreamWriter writer = new SafeStreamWriter(outputFile, false, encoding)) { writer.Write(data); } }
private void Write(string txt) { writer.Write(txt); }