diff --git a/FFMpegCore/FFMPEG/FFBase.cs b/FFMpegCore/FFMPEG/FFBase.cs index cc52b39..d38c8ca 100644 --- a/FFMpegCore/FFMPEG/FFBase.cs +++ b/FFMpegCore/FFMPEG/FFBase.cs @@ -14,12 +14,27 @@ public abstract class FFBase : IDisposable protected string ConfiguredRoot; protected Process Process; - protected FFBase() + protected FFBase(FFMpegOptions opts = null) { - ConfiguredRoot = - !File.Exists(_ConfigFile) ? - _DefaultRoot : - JsonConvert.DeserializeObject>(File.ReadAllText(_ConfigFile))["RootDirectory"]; + var options = opts; + + if ( + opts == null && + File.Exists(_ConfigFile) + ) + { + options = JsonConvert.DeserializeObject(File.ReadAllText(_ConfigFile)); + } + + if (options == null) + { + options = new FFMpegOptions + { + RootDirectory = _DefaultRoot + }; + } + + ConfiguredRoot = options.RootDirectory; } /// diff --git a/FFMpegCore/FFMPEG/FFMpegOptions.cs b/FFMpegCore/FFMPEG/FFMpegOptions.cs new file mode 100644 index 0000000..5030e39 --- /dev/null +++ b/FFMpegCore/FFMPEG/FFMpegOptions.cs @@ -0,0 +1,7 @@ +namespace FFMpegCore.FFMPEG +{ + public class FFMpegOptions + { + public string RootDirectory { get; set; } + } +}