예제 #1
0
        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));
                }
            }
        }
예제 #2
0
        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;
        }
예제 #3
0
        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);
        }