예제 #1
0
파일: Log.cs 프로젝트: Moonshine0806/Test
        static Log()
        {
            try
            {
                if (!Directory.Exists(LogFolder))
                {
                    Directory.CreateDirectory(LogFolder);
                }
#if false
                StreamWriter = new StreamWriter(Console.OpenStandardOutput())
                {
                    AutoFlush = true
                };
                Console.SetOut(StreamWriter);
#else
                var logFilePath = Path.Combine(LogFolder, @"TestLog.log");
                FileStream   = new FileStream(logFilePath, FileMode.Append);
                StreamWriter = new StreamWriter(FileStream, Encoding.UTF8)
                {
                    AutoFlush = true
                };
#endif
            }
            catch (Exception e)
            {
#if DEBUG
                Console.WriteLine("Exception happened when redirect stream to console out: " + e);
#else
                Console.WriteLine("Exception happened when create folder or new StreamWriter: " + e);
#endif
                throw;
            }

            // TODO because it's in dll, below code maybe need to change
            Recorder = ScreenRecorder.CreateRecorder(LogFolder + @"\" + "TestRecord.mp4");
            AppDomain.CurrentDomain.ProcessExit += Log_Dtor;
        }
예제 #2
0
        public static ScreenRecorder CreateRecorder(string videoPath)
        {
            var screenRecorder = new ScreenRecorder(videoPath);

            return(screenRecorder);
        }