public static void Main(string[] args) { Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress); using (var app = StopwatchApp.Create("time.log")) { while (KeepRunning) { app.Apply(Console.ReadKey(true)); } } }
public static StopwatchApp Create(string logFileName) { Guard.NotNullOrEmpty(logFileName, "logFileName"); var logFile = new FileInfo(logFileName); if (!logFile.Directory.Exists) { logFile.Directory.Create(); } var file = new StreamWriter(logFile.FullName, true); var sw = new StopwatchApp(file, System.Console.Out); sw.Run(); return sw; }
public static StopwatchApp Create(string logFileName) { Guard.NotNullOrEmpty(logFileName, "logFileName"); var logFile = new FileInfo(logFileName); if (!logFile.Directory.Exists) { logFile.Directory.Create(); } var file = new StreamWriter(logFile.FullName, true); var sw = new StopwatchApp(file, System.Console.Out); sw.Run(); return(sw); }