mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-01-18 12:36:44 +00:00
FFMpegCore: enable root configuration view ctor
This commit is contained in:
parent
7dca87a73f
commit
02ac7c5ac0
2 changed files with 27 additions and 5 deletions
|
@ -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<Dictionary<string, string>>(File.ReadAllText(_ConfigFile))["RootDirectory"];
|
||||
var options = opts;
|
||||
|
||||
if (
|
||||
opts == null &&
|
||||
File.Exists(_ConfigFile)
|
||||
)
|
||||
{
|
||||
options = JsonConvert.DeserializeObject<FFMpegOptions>(File.ReadAllText(_ConfigFile));
|
||||
}
|
||||
|
||||
if (options == null)
|
||||
{
|
||||
options = new FFMpegOptions
|
||||
{
|
||||
RootDirectory = _DefaultRoot
|
||||
};
|
||||
}
|
||||
|
||||
ConfiguredRoot = options.RootDirectory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
7
FFMpegCore/FFMPEG/FFMpegOptions.cs
Normal file
7
FFMpegCore/FFMPEG/FFMpegOptions.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace FFMpegCore.FFMPEG
|
||||
{
|
||||
public class FFMpegOptions
|
||||
{
|
||||
public string RootDirectory { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue