mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 00:24:14 +01:00
FFMpegCore: enable root configuration view ctor
Former-commit-id: 02ac7c5ac0
This commit is contained in:
parent
0cb4f0e660
commit
2fe729832e
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