public static void WriteLogFile(string message) { Console.WriteLine(message);
if (File.Exists("C:\\log.txt")) { using (StreamWriter SWriter = File.AppendText("C:\\log.txt")) { SWriter.WriteLine(message); } } else { using (StreamWriter SWriter = File.CreateText("C:\\log.txt")) { SWriter.WriteLine(message); } } }