public void SetUp()
 {
     screenShooterMock = MockRepository.GenerateStrictMock<IScreenShooter>();
     screenShooterMock.Expect(m => m.Capture("")).IgnoreArguments().Repeat.Once();
     processHandlerStub = MockRepository.GenerateStub<IProcessHandler>();
     processHandlerStub.Expect(m => m.GetCurrentProcess()).Return("process");
     validator = new ProcessCaptureValidator(processHandlerStub, new string[] { "process" });
     processRecorder = new ProcessRecorder(
         new RecordConfiguration() { Name = "", Path = "", Period = 1000 }, validator, screenShooterMock);
 }
示例#2
0
        public static void Main(string[] args)
        {
            ICommandLineParser parser = new CommandLineParser();
            LineCommandOptions options = new LineCommandOptions();
            if (parser.ParseArguments(args, options))
            {
                if (ValidateOptions(options))
                {
                    int second = 1000;
                    int fps = 12;
                    IList<string> processes = options.Processes;

                    RecordConfiguration configuration = new RecordConfiguration()
                    {
                        Name = options.RecordName,
                        Path = options.Path,
                        Period = second / fps
                    };

                    RecordStorageManager storageManager = new RecordStorageManager();
                    storageManager.SetRecordDirectory(configuration.StoragePath);
                    IProcessHandler processHandler = new ProcessHandler();
                    IScreenShooter screenShooter = new ScreenShooter();
                    ProcessCaptureValidator validator = new ProcessCaptureValidator(processHandler, processes);
                    ProcessRecorder processRecorder = new ProcessRecorder(configuration, validator, screenShooter);

                    processRecorder.Start();
                    Console.WriteLine("Recording...");
                    Console.WriteLine("Press the Enter to stop recording.");
                    Console.ReadLine();
                    processRecorder.Stop();
                }
            }
            else
            {
                Console.WriteLine(options.GetUsage());
            }
        }