コード例 #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
ファイル: ScreenRecorder.cs プロジェクト: Moonshine0806/Test
        public static ScreenRecorder CreateRecorder(string videoPath)
        {
            var screenRecorder = new ScreenRecorder(videoPath);

            return(screenRecorder);
        }