FFMpegCore: enable root configuration view ctor

Former-commit-id: 02ac7c5ac0
This commit is contained in:
Vlad Jerca 2019-03-01 20:45:47 +02:00
parent 0cb4f0e660
commit 2fe729832e
2 changed files with 27 additions and 5 deletions

View file

@ -14,12 +14,27 @@ public abstract class FFBase : IDisposable
protected string ConfiguredRoot; protected string ConfiguredRoot;
protected Process Process; protected Process Process;
protected FFBase() protected FFBase(FFMpegOptions opts = null)
{ {
ConfiguredRoot = var options = opts;
!File.Exists(_ConfigFile) ?
_DefaultRoot : if (
JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(_ConfigFile))["RootDirectory"]; opts == null &&
File.Exists(_ConfigFile)
)
{
options = JsonConvert.DeserializeObject<FFMpegOptions>(File.ReadAllText(_ConfigFile));
}
if (options == null)
{
options = new FFMpegOptions
{
RootDirectory = _DefaultRoot
};
}
ConfiguredRoot = options.RootDirectory;
} }
/// <summary> /// <summary>

View file

@ -0,0 +1,7 @@
namespace FFMpegCore.FFMPEG
{
public class FFMpegOptions
{
public string RootDirectory { get; set; }
}
}