public ScreenRecorder(int fps, float durationSeconds, Rectangle captureRectangle, string cachePath, ScreenRecordOutput outputType) { if (string.IsNullOrEmpty(cachePath)) { throw new Exception("Screen recorder cache path is empty."); } FPS = fps; DurationSeconds = durationSeconds; CaptureRectangle = captureRectangle; CachePath = cachePath; OutputType = outputType; if (OutputType == ScreenRecordOutput.AVI || OutputType == ScreenRecordOutput.AVICommandLine) { bool showOptions = OutputType == ScreenRecordOutput.AVI; aviCache = new AVICache(CachePath, FPS, CaptureRectangle.Size, showOptions); } else if (OutputType == ScreenRecordOutput.GIF) { hdCache = new HardDiskCache(CachePath); } }